Skip to content

Validation breaks when using anyOf or oneOf and the root schema has an $id #2471

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

Closed
3 tasks done
nickgros opened this issue Jul 15, 2021 · 1 comment
Closed
3 tasks done
Labels
any-one-all-of Related to fixing anyOf, oneOf or allOf bug

Comments

@nickgros
Copy link
Contributor

Prerequisites

Description

Both live validation and regular validation break if you supply a schema that has an $id and contains an anyOf or oneOf property.

It breaks the global AJV instance irreversibly, because the validator won't work in general for forms with the same $id that don't normally create this bug unless you refresh the page.

Steps to Reproduce

  1. Add a schema with an $id and contains anyOf or oneOf
  2. Validation no longer works

Expected behavior

Here's an example without the $id, and validation is working.

Actual behavior

Here's an example with the $id. Notice that validation no longer works. If you maintain the $id, the validator still won't work, even if you remove the anyOf field

Version

3.0.0. I think this bug also existed in 2.5

@nickgros
Copy link
Contributor Author

Seems to have been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
any-one-all-of Related to fixing anyOf, oneOf or allOf bug
Projects
None yet
Development

No branches or pull requests

3 participants