Add if/then/else test cases for issue #767
This PR adds additional tests for correct handling of the false schema within
conditional keywords (if, then, else), as described in Issue #767.
What these tests cover
- When
ifmatches,then: falsemust cause validation to fail. - When
ifdoes not match,else: falsemust cause validation to fail. - When both
thenandelsearefalse, all data must be invalid regardless of the branch taken. - Ensures that
falseis treated as a schema that always fails, matching JSON Schema semantics, rather than being interpreted as{}.
These tests fill gaps in draft2020-12 conditional logic coverage, addressing the behavior described in Issue #767.
Fixes #767.
@Zash, do these tests cover the case you were talking about in #767? It's not 100% clear to me what the case was exactly, especially because the example given was for not and these tests cover then/else.
I think just the third test is sufficient. Or, just the first two. But, the first two and the third seem to be testing the same thing.
Thanks for the feedback — that makes sense.
I see how the third test is logically implied by the first two and doesn’t introduce a new failure mode. I’ll remove that case and update the tests accordingly.
I’ll push an update shortly.
@Zash, do these tests cover the case you were talking about in #767? It's not 100% clear to me what the case was exactly, especially because the example given was for
notand these tests coverthen/else.
Thanks for raising that.
I didn’t add new tests for not because handling of false with not is already covered in the existing not.json tests, which assert that false is treated as a schema that always fails (rather than {}).
This PR was scoped specifically to fill the gap for conditional keywords (if / then / else), where equivalent coverage didn’t previously exist.
If you’d prefer additional or cross-referenced coverage for not in this context, I’m happy to add it.
All checks are passing now. I’ve removed the redundant test case from all three files.
Please let me know if anything else needs adjustment.