Repository navigation
FIX: show per-field API validation errors in the finding dialog - #3786
Open
alexcastgonz (pcbeingused333) wants to merge 1 commit into
Open
alexcastgonz (pcbeingused333) wants to merge 1 commit into
alexcastgonz (pcbeingused333) wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Description
Fixes #3711
Cause. The backend 422 handler returns an RFC 7807 body with
detail: "Request validation failed"and anerrors[]array (field,message,code).toApiErroronly readdetail/type, so the finding dialog showed just the generic text and never said which field was wrong.Fix.
ApiErrornow carriesfieldErrors(parsed defensively fromerrors[]; malformed entries are skipped, empty when absent).FindingDialogshows theattack_result_idmessage (e.g. "Input should be a valid UUID") on the Evidence attack ID field, marks it invalid, and keeps Save disabled until that field is edited. Messages for other fields go in the error bar asfield: message.No backend or API contract change.
Tests and Documentation
errors.test.ts: parsing oferrors[], malformed entries, and bodies without it.FindingDialog.test.tsx: a rejected 422 shows the API message on the field, setsaria-invalid, disables Save, and re-enables it after editing.mainand the full files pass (34/34) with jest. No documentation changes needed.This change was prepared with AI assistance (Claude Code).