Repository navigation
Conversation
Draft 06 and later reused the draft 04 minimum and maximum checks, which
make the bound exclusive when exclusiveMinimum or exclusiveMaximum is
truthy. Since draft 06 those keywords are numbers validated on their
own, so {"maximum": 10, "exclusiveMaximum": 15} rejected 10.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In draft 06 and later,
minimumandmaximumbecome exclusive when the schema also setsexclusiveMinimumorexclusiveMaximumto a number other than zero:10 satisfies both keywords in each schema, and
jsonschema.Draft7Validator(schema).is_valid(10)isTruefor both.CodeGeneratorDraft06inheritsgenerate_minimumandgenerate_maximumfrom draft 04, whereexclusiveMinimum/exclusiveMaximumare booleans that make the bound exclusive. Since draft 06 they are numbers and are already checked on their own bygenerate_exclusive_minimum/generate_exclusive_maximum, but the inherited code still reads them as a flag. Any number other than0is truthy, so the bound turned exclusive. Draft 06 now overrides both methods with the inclusive check only, so draft 04 behaves as before.Added
test_minimum_and_maximum_stay_inclusive_next_to_exclusive_keywordstotests/test_number.pyfor drafts 06 and 07. It fails before the change and passes after.Checks run:
python -m pytest -m "not benchmark" tests: 4543 passed (4539 plus the 4 new cases), with the same xfailed and xpassed counts as beforepython -m pylint fastjsonschema: same warnings as before, 9.90/10Found by differential testing against
jsonschemaon generated draft 07 schemas.