-
-
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
some tests of the interactions between $id, $anchor and $ref #383
Conversation
ddc859e
to
9d0c502
Compare
e760666
to
d593591
Compare
Merged, thanks again! |
{ | ||
"description": "order of evaluation: $id and $ref", | ||
"schema": { | ||
"$comment": "$id must be evaluated before $ref to get the proper $ref destination", | ||
"$id": "/base/base.json", | ||
"$ref": "int.json", | ||
"$defs": { | ||
"bigint": { | ||
"$comment": "canonical uri: /base/int.json", | ||
"$id": "int.json", | ||
"maximum": 10 | ||
}, | ||
"smallint": { | ||
"$comment": "canonical uri: /int.json", | ||
"$id": "/int.json", | ||
"maximum": 2 | ||
} | ||
} | ||
}, |
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.
This test is wrong. $id
in the presence of $ref
in draft7 will do nothing. consequently, attempts to resolve the ref to "/int.json" will fail.
It looks like I copied this test erroneously from draft2019-09, and it was never tested.
The intent of them is *not* to express that an implementation might wish to recognize these keywords. The intent of them is precisely the same as the original intent -- to allow an implementation to test itself for *not* recognizing new keywords. Such an implementation should enable these tests, as it is free to do so, and these tests will help ensure it does not accidentally leak newer keywords backwards in time if it doesn't mean to. All of the previous discussion was strictly centered on not putting these in the required directory. The reason is that all drafts *allow* implementations to add extra keywords. So a compliant implementation may indeed decide it actively *wants* to implement new keywords. Then this file would not help them, and they wouldn't run it. They would presumably love a version of this file that *did* contain all the future assertions as correct for future drafts, and in the future we could provide one. But given no implementations really do do this, at least as far as I'm aware, and given that this version of the file is here and written and more common, it would seem perfectly reasonable to have it and hope for the other version if or when someone wants it. Further discussion is in #383 and later #559. This reverts commit f605fbf.
@@ -48,6 +48,67 @@ | |||
"valid": false | |||
} | |||
] | |||
}, | |||
{ | |||
"description": "non-schema object containing a plain-name $id property", |
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.
This uses if
/then
/else
which weren't introduced to draft 7. We need to remove these from draft 6.
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.
Would you mind opening an issue, I'll remove them if someone doesn't get to it first
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.
Fix in #562
some more weird edge cases with $id, $anchor and $ref that might tickle a sloppy implementation.
I only went back as far as draft6 because the URI semantics are not as well defined before then.