Repository navigation
fix(inertia,hosting): key validation errors by form field, first message wins; honour error bags (#776, #777) - #799
Merged
Conversation
…age wins; honour error bags (#776, #777) - New simple_module_inertia.errors_from_validation: one key per top-level form field (union-member tags, list indices and nested-model segments no longer become keys), first message per field as Laravel does. The leading body/query/... segment is dropped only for RequestValidationError, so a model field really named 'path' keeps its key. - validation_errors_to_dict and the adapter's validation handler share it. - redirect_back_with_errors nests errors under X-Inertia-Error-Bag. Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2
…n-errors-776-777 # Conflicts: # CHANGELOG.md
- empty X-Inertia-Error-Bag means no bag; shared scope_errors() helper for both callers - drop the 'form' request source FastAPI never emits - docstring and CHANGELOG note the new helpers Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2
… the override forms A model validator error (e.g. 'tenant/user scope requires a scope_id') has an empty loc and is flashed under errors.general, which neither Create nor Edit rendered, so the submit silently bounced back. Found by /ship QA on #776. Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2
- strip pydantic's 'Value error, ' prefix via a shared stripValueErrorPrefix helper - CHANGELOG entry for the settings form-level error Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2
…n-errors-776-777 # Conflicts: # CHANGELOG.md
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying simple-module-python with
|
| Latest commit: |
620f3e1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d9406f1a.simple-module-python.pages.dev |
| Branch Preview URL: | https://fix-inertia-validation-error.simple-module-python.pages.dev |
…n-errors-776-777 # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes how form validation errors reach Inertia pages (tracking #780).
Closes #776
Closes #777
What changed
simple_module_inertia.errors_from_validation()keys each pydantic error by its top-level form field and keeps the first message per field, as Laravel does.("quantity", "int")), list indices and nested-model segments no longer become keys. Before, a union field's error landed underint/booland no form showed it.body/query/… segment is dropped only for aRequestValidationError(request_source=True), so a model field really namedpathkeeps its key.simple_module_hosting.inertia_utils.validation_errors_to_dictand the adapter's validation handler use it.redirect_back_with_errorsnests errors underX-Inertia-Error-Bagthrough a sharedscope_errors(). An empty header means no bag, matchingInertiaRequest.error_bag.errors.general(e.g. "tenant/user scope requires a scope_id"). The submit silently bounced back to the form. A newFormLevelErrorcomponent shows them, with pydantic's "Value error, " prefix stripped through a shared helper.Callers checked: permissions and settings pages read only top-level keys (
value,key,scope,scope_id,permissions,delete,errors[f.name]). No page setserrorBag.Verification
make lint✓ ·make test-py(8 workers): 7320 passed, 43 skipped ✓ ·make test-js: 886 passed ✓errors.generalrendering above) and fixed, re-test PASS.Not changed here (separate, existing behaviour): the settings store accepts override keys of any format (e.g.
Bad Key!!).https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2