-
-
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
tests for $ref using base URI learned from $id #403
base: main
Are you sure you want to change the base?
tests for $ref using base URI learned from $id #403
Conversation
Oops! I just remembered that "$defs" is only in 2019-09. For the remote file, should I make that test 2019-09 only? |
For cross-checking, the errors returned by the new ref.json tests for my implementation are:
and the new refRemote.json tests:
|
The other files in remotes use 'definitions', and the 2019-09 spec says that that location should be kept reserved for use by refs, so I would just rename $defs to definitions there. |
I'm happy to move it, but I am curious: Where does the spec require 2019-09 implementations to handle "definitions"? I see that the keyword is reserved to prevent redefining it with different behavior, but I can't find where its behavior is actually specified in the 2019-09 spec. |
That's how I read the section on references to possible non schemas. Seems like a ref to "definitions" (an unknown keyword) would be undefined behavior.
For the official test suite? Yes :) If the spec classifies it as undefined behavior, I don't think it's right for the acceptance tests to expect specific behavior there. I'm happy to acknowledge that I might be misinterpreting the spec, but with my current understanding, I'm not comfortable using "definitions" in 2019-09 test cases. At the very least, I can resolve the issue in this PR by creating two files for this case: one with "$defs", and one with "definitions". |
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.
Works on my implementation.
(Didn't look into it further, because no issues noticed).
@rjmill sorry for the long delay here -- any chance you're willing to resolve the conflicts for this PR so I can have a look for review? |
Yes, that's correct, we should use |
(I believe we already do in all other places -- if that means we need multiple versions of the remote so be it...) |
I'm willing, but free time may be a bit of an issue 😅 If someone wants to take this PR over, I won't be offended. Otherwise, I'll try to get to it when I have the time. The merge conflicts don't look too tricky, from what I can see. Looks like my |
@rjmill I've run these tests against my implementation and they all look good. If you can resolve the conflicts, I think we're happy to merge. |
d45cc45
to
415bda9
Compare
@gregsdennis I fixed the merge conflicts and pushed again. Let me know if there's anything else I can do. btw, I am still the same person. I just changed my last name (got married) and changed my gh handle to match. |
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.
Comments and please copy:
- the 2019-09 tests into 2020-12 and draft-next
- the draft 7 test into draft 6
@Julian do you think it's worth having this test for draft 4?
"allOf": [ | ||
{"$ref": "#/$defs/referencing"} | ||
], | ||
"$defs": { |
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.
$defs
is only a 2019-09 and later keyword. For draft 7, you'll need a copy of this file that uses definitions
.
"allOf": [ | ||
{"$ref": "#/$defs/referencing"} | ||
], | ||
"$defs": { |
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.
$defs
should be definitions
for draft 7
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.
(It's weird that the sanity check for unknown keywords doesn't flag this, as that's the point of it, but I don't have time to look into why right this second.)
"allOf": [ | ||
{"$ref": "#/$defs/referenced"} | ||
], | ||
"$defs": { |
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.
$defs
-> definitions
We write it's "frozen" in the README. I still personally honestly do try to cover it though when I add tests, because it's still reasonably popular to see in the wild from what I see, regardless of what we hope. So I'd personally do it, yeah, but I understand if/when others are less willing to put in the effort for it. |
Oddly enough, the "local" version worked fine with my implementation, while the "remote" version broke it.
This is my first time adding a remote case. I tried to amend the right places in the scripts, but I may have missed some spots.
I put the same tests in draft7 and 2019-09.