Skip to content

Trimming alternatives for anyOf/oneOf based on type#170

Open
srivastava-diya wants to merge 3 commits intohyperjump-io:mainfrom
srivastava-diya:main
Open

Trimming alternatives for anyOf/oneOf based on type#170
srivastava-diya wants to merge 3 commits intohyperjump-io:mainfrom
srivastava-diya:main

Conversation

@srivastava-diya
Copy link
Contributor

Description

This PR improves the error reporting for anyOf and oneOf keywords by filtering out irrelevant schema alternatives based on the instance's type. This results in significantly cleaner error messages.

Fixes : #165

Changes

  1. The error handlers now check the type keyword of each alternative. If an alternative expects a type different from the instance it is excluded from the error report.

  2. If filtering results in only one alternative, then anyOf / oneOf wrapper error is removed entirely.

  3. If no alternatives match the instance type (or if types aren't specified), the original behavior is preserved all alternatives are reported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discriminate between instance alternatives based on type

1 participant

Comments