Skip to content

Conversation

@Shristibot
Copy link

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 if matches, then: false must cause validation to fail.
  • When if does not match, else: false must cause validation to fail.
  • When both then and else are false, all data must be invalid regardless
    of the branch taken.
  • Ensures that false is 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.

@Shristibot Shristibot requested a review from a team as a code owner December 12, 2025 20:25
Copy link
Member

@karenetheridge karenetheridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One test case is wrong.

I'm concerned that if it passed for your implementation, you have other issues you need to worry about! e.g. the properties keyword is never invalid when the data instance is not an object.

Also, these tests should be copied to all the version directories where they are relevant (if/then/else was added in draft7).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handling of false in then or else

3 participants