-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
"oneOf" Validation behaves the opposite way #113
Comments
First I want to say I've tested several json schema validation packages and yours is the best in my opinion. Next, I wanted to show a behavior that I wasn't expecting but could easily be my own misunderstanding of json schema. It involves array items and oneOf:
A sample JSON:
I also used the online validator at http://jsonschemalint.com/ which may be out-of-date. I was otherwise expecting 3 and 4 items of "anArray" to fail validation. I could have misunderstood how oneOf should be working and any advice is greatly appreciated. I'm also willing to pitch in and fix this if pull requests are welcome. |
I have confirmed this edge case by the generated code. I'll try to solve this in the coming week. |
@Geo42 the behavior here is correct in your case, since @ReinsBrain the behavior is correct in your case as well. You have |
I recently tried to validate json against a schema that contains a "oneOf" fied.
The validator I used is http://jsonschemalint.com/ that uses this very library.
here is the shema
The weird thing is that it validates only when bar length in smaller than 3 or greater than 5 which is the opposite of the expected behaviour
valid json are :
invalid json are :
Adding the field "additionalProperties" makes it work right.
The text was updated successfully, but these errors were encountered: