feat: Surface oneOf/anyOf validation failures in an RFC 9457 errors[] array#104
Merged
Conversation
Each failure is now an entry in an errors[] array with a #/... JSON-Pointer-in-fragment pointer. oneOf/anyOf failures list one entry per branch, deepest-first and de-duplicated.
|
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.



Summary
application/problem+jsonresponses now carry anerrors[]array (RFC 9457).pointerandkeywordmove from the top level into one entry per failure:{ "pointer": "#/…", "keyword": …, "detail": … }.oneOf/anyOffailures now surface each failed branch's real error instead of only the opaquematched 0 of N … branchescount. Entries are ordered most-likely-cause first (the branch the payload most resembles — deepest pointer) and exact duplicates are collapsed. The top-leveldetailkeeps the combinator summary.#/…JSON-Pointer-in-fragment form (#for the whole body).instanceis intentionally not added (optional under RFC 9457; the defaultExceptionHandlerhas no request context by design).Before
{ "type": "about:blank", "title": "Bad Request", "status": 400, "detail": "matched 0 of 2 oneOf branches", "pointer": "/offers/0", "keyword": "oneOf" }After
{ "type": "about:blank", "title": "Bad Request", "status": 400, "detail": "matched 0 of 2 oneOf branches", "errors": [ { "pointer": "#/offers/0/conditions/0/itemSet/minQuantity", "keyword": "type", "detail": "expected number" } ] }Test plan
mvn verifygreen: 522 unit tests + 68 integration tests, 0 failures.#/…fragment form, empty-array and null-keyword omission, and the no-throw happy-path contract.OpenApiServerIT/shapesasserts the new array end-to-end: a distinct-leaf body yields two entries; an identical-leaf body de-duplicates to one.Design:
docs/superpowers/specs/2026-06-08-validation-errors-array-design.md