Skip to content

Add tests for not: {} schemas for all values. #714

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

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Add tests for not: {} schemas for all values. #714

merged 1 commit into from
Jan 29, 2024

Conversation

Julian
Copy link
Member

@Julian Julian commented Jan 29, 2024

This adds tests that essentially say all instances are valid under "not": false and all are invalid under "not": true and "not": {}.

One would think these would be quite trivial tests... but not all implementations pass them surprisingly!

This was noticed as part of tweaking Bowtie's smoke test for implementations -- which it uses to make sure JSON Schema implementations are running correctly -- in what I thought was a non-functionally meaningful way.

But it turns out one implementation fails one of these tests :) -- namely it incorrectly considers null valid under not: {}.

The actual contents here match what we use in other places (e.g. in boolean-schemas.json).

While we're here, this also adds a test for not: not, i.e. double negation, with just one value to check.

One would think these would be quite trivial tests... but
not all implementations pass them surprisingly!

This was noticed as part of tweaking Bowtie's smoke test for
implementations (bowtie-json-schema/bowtie@3984ef6#diff-dc32c0287345ff144e16658c5c157495f1c3c3f46c71dd3a58b2414663dcd08aR450-R458)
-- which it uses to make sure JSON Schema implementations are running
correctly -- in what I thought was a non-functionally meaningful way.

But it turns out one implementation fails one of these tests :) --
namely it incorrectly considers `null` valid under `not: {}`.

The actual contents here match what we use in other places (e.g. in
boolean-schemas.json).

While we're here, this also adds a test for not: not, i.e. double
negation, with just one value to check.
@Julian Julian requested a review from a team as a code owner January 29, 2024 15:38
@Julian
Copy link
Member Author

Julian commented Jan 29, 2024

Thanks!

@Julian Julian merged commit b41167c into main Jan 29, 2024
@Julian Julian deleted the more-not branch January 29, 2024 17:49
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.

2 participants