-
Notifications
You must be signed in to change notification settings - Fork 184
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
validateMultiple() and banUnknownProperties incompatible with (certain) anyOf #74
Comments
Thanks for the bug (as well as the very helpful diagnosis!). I'm pretty busy right now, but I'll try and get a fix to you by the end of Friday - sorry for the delay. |
ahultgren
added a commit
to omninews/swagger-mocha
that referenced
this issue
Nov 11, 2014
…t. Needed mainly becuase of geraintluff/tv4#74
Still having this same issue. @geraintluff do you have any plans on fixing this? Or any hints in case I need to fix it myself? |
👍 please fix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using grunt-tv4, I'm trying to validate my schema files. One of them is topicName.json:
Running it with the options
Produces no errors, it is a valid schema. (json-v4.json is the meta schema from json-schema.org)
But, if I also enable
multi: true
, then the following error is reported:As it turns out, validateAnyOf() does not properly handle a true
this.trackUnknownProperties
.Note that
type: "string"
is invalid,type: ["string"]
is valid. This is because the loop in ValidatorContext.validateAnyOf() only properly resets the this.error array when the last checked subSchema was valid. In the given case, the last subSchema (checking an array) fails, and the errors are kept in the this.errors array, bleeding through.validateAnyOf() should report all errors of all subSchemas only if all of them failed during validateMultiple().
The text was updated successfully, but these errors were encountered: