-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Add tests for unevaluated with dynamic reference #696
Merged
Julian
merged 4 commits into
json-schema-org:main
from
jdesrosiers:unevaluated-dynamicref
Nov 16, 2023
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2834c63
Add tests for unevaluated with dynamic reference
jdesrosiers 8ba1c90
Update unevaluted with dynamic ref to be more likely to catch errors
jdesrosiers 4922204
Add unevaluted with dynamic ref tests to draft-next
jdesrosiers 5d0c05f
Fix copy/paste error
jdesrosiers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of keywords might affect order of execution in implementations, so should we put
unevaluatedProperties
first, to cover that as well? (that might be a separate issue, since there are a lot of test cases here that haveunevaluatedProperties
last in the list)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have other tests that ensure key order is not a factor in evaluation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for
$dynamicRef
and$ref
though. My implementation passed this test case but just by luck 😅Moving
"$ref": "#/$defs/bar"
down in"unevaluatedItems with $ref"
, for example, fails.It's also really important to test references bc they are not explicitly listed in the spec section: https://json-schema.org/draft/2020-12/json-schema-core#name-unevaluatedproperties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's practical to check order of keywords for every combination of keywords. We have tests that ensure order of keywords is irrelevant. It's expected that this is applied across an implementation, not just for those tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec does address references:
"This includes but is not limited to the in-place applicators defined in this document."
References are in-place applicators because they evaluate the instance against the schema they're referencing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I agree that it's impractical to test ordering for every combination of keywords, I'm of the opinion that anything that exposed a real bug in an implementation belongs in the test suite. I'll move
unevaluated*
to be the first keyword and include a note explaining why.