-
Notifications
You must be signed in to change notification settings - Fork 325
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
Issue386: FailFast should not cause exception on if #485
Conversation
@@ -0,0 +1,5 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have all of the test cases in https://json-schema.org/understanding-json-schema/reference/conditionals.html#if-then-else
You could maybe make two arrays like so
{
"passing": [
{ your example above },
{ other passing example from the link },
...
],
"failing": [
{ "data": { a failing example from the link }, "expectedErrors":["error1", "error2"] },
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed this to have all the tests above in this 'fail fast' test.
I've also updated the draft2019-09/if-then-else.json and draft7/if-then-else.json to have the full set of tests from that link too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, though @stevehu must approve
@gareth-robinson I don't know if I have merged the PR before you have updated the test cases. If that is the case, please resubmit the PR from your forked branch. The test cases are very important to ensure our code is not going to be broken by others. Thanks. |
Excellent!. Thanks a lot for your help. |
Fix for #386
When failFast is enabled the code that builds the ValidationMessages throws an exception rather than returning a Set.
In if/else/then blocks this could cause the validation to fail whenever an 'if' was false.
I've a basic change here to just wrap the if validation in a try/catch if that's appropriate?
Btw, when running the tests I found that Issue366Test wasn't working, as it was looking in the wrong location (but otherwise is not related to this change)