Issue386: FailFast should not cause exception on if#485
Issue386: FailFast should not cause exception on if#485stevehu merged 2 commits intonetworknt:masterfrom
Conversation
| @@ -0,0 +1,5 @@ | |||
| { | |||
There was a problem hiding this comment.
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.
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.
SiemelNaran
left a comment
There was a problem hiding this comment.
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)