Skip to content

validation error for oneOf objects with 'additionalProperties':false #1576

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
tdamsma opened this issue Jan 29, 2020 · 1 comment
Closed

Comments

@tdamsma
Copy link

tdamsma commented Jan 29, 2020

Sorry for the title, best see the examples for what I mean. The form on this playground link not validate, while I think it should.

Removing the 'additionalProperties':false on line 27 returns a
schema that validates as expected, however now the validation is too lax.

I'm trying to create forms to generate valid jsonschema's and it's proving quite challenging

@tdamsma
Copy link
Author

tdamsma commented Jan 31, 2020

after more digging around I found that the combining oneOf and additionalProperties is not a good idea. See also python-jsonschema/jsonschema#193 and especially the chapter "Additional properties inside compound keywords anyOf, oneOf, etc." in the Ajv faq

See this playground for a working example for a combination of mutually exclusive oneOf fields without using 'additionalProperties':false

@tdamsma tdamsma closed this as completed Jan 31, 2020
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

No branches or pull requests

1 participant