Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use full schema path to look up type validators for anyOf operator #663

Merged
merged 2 commits into from
Mar 1, 2023
Merged

Use full schema path to look up type validators for anyOf operator #663

merged 2 commits into from
Mar 1, 2023

Conversation

pshevche
Copy link
Contributor

@pshevche pshevche commented Feb 16, 2023

Summary

#626 changed how the schema path is set for JsonSchemas of anyOf declaration. However, it did not account for the fact that this schema path is used to identify type validators that belong to the operator. AnyOfValidator#validate still relied on the previous schema path and could not apply special handling to those validators (i.e. execute just the validator that matches the value). As a result, TypeValidators for all options of anyOf property were evaluated separately and results aggregated.

Note: I have no clue why the diff for AnyOfValidator is so ugly. The screenshot shows what exactly changed:
Screenshot 2023-02-16 at 2 14 59 PM

Resolves #662

@stevehu stevehu requested a review from prashanthjos February 16, 2023 14:04
@stevehu
Copy link
Contributor

stevehu commented Feb 16, 2023

@prashanthjos, Could you please review the changes to ensure they won't impact your application? Thanks.

@stevehu stevehu merged commit bb63267 into networknt:master Mar 1, 2023
@stevehu
Copy link
Contributor

stevehu commented Mar 1, 2023

@pshevche Thanks a lot for your help.

@pshevche
Copy link
Contributor Author

pshevche commented Mar 1, 2023

@pshevche Thanks a lot for your help.

My pleasure :)

@pshevche pshevche deleted the pshevche/662/misleading-error-allOf-invalid-property branch March 1, 2023 14:15
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.

Misleading validation error for anyOf property when required value is invalid
2 participants