Skip to content
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

Merged
merged 3 commits into from
Jun 22, 2022

Conversation

karenetheridge
Copy link
Member

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.

@Julian Julian force-pushed the ether/more-anchor-and-id-tests branch from e760666 to d593591 Compare June 22, 2022 17:00
@Julian Julian merged commit 0b777ff into main Jun 22, 2022
@Julian Julian deleted the ether/more-anchor-and-id-tests branch June 22, 2022 17:19
@Julian
Copy link
Member

Julian commented Jun 22, 2022

Merged, thanks again!

Comment on lines 648 to 666
{
"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
}
}
},
Copy link
Member Author

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.

Julian added a commit that referenced this pull request Jun 25, 2022
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",
Copy link
Member

@gregsdennis gregsdennis Jun 28, 2022

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.

Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

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

Fix in #562

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.

4 participants