You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So after the merging of #360 which gave the resources unique names, I was able to test these tests against my implementation, and I got some failures. After closer examination I think the test is wrong, not my implementation:
The errors are in the schema with description "base URI change - change folder". Let's look at that schema:
we start evaluating the subschema at /$defs/baz. We got here through the $ref "http://localhost:1234/baseUriChangeFolder/", so that's our new base uri (used for subsequent uri resolution).
The error is that the uri at /properties/list/$ref should have a leading /, so it doesn't append to whatever existing path we already had in our base uri. When we first identify resources in this schema, the path component of the base uri is "/scope_change_defs1.json" -- there are no directory portions to use in the base, so resolving "baseUriChangeFolder/" against that gives us "/baseUriChangeFolder/" as the new base. But when we actually traverse the $ref and evaluate the subschema's $id, the base uri changes to "baseUriChangeFolder/" resolved against the base, which is "/baseUriChangeFolder/baseUriChangeFolder/".
If we're in agreement that this is an error, I can submit a one-character pull request that amends the uri reference at /$defs/baz/$id. If not, please explain why you disagree :)
[I]n accordance with RFC 3986 section 5.1.2 regarding encapsulating entities, if an "$id" in a subschema is a relative URI-reference, the base URI for resolving that reference is the URI of the parent schema resource.
What I have been doing is setting the "current base uri, to be used in future uri resolution" to the uri of the current resource being jumped to via a $ref, but that means if the uri is relative, on seeing the $id at the current root, the uri is resolved again, resulting in the doubling of the path.
karenetheridge
added
invalid
A mistaken bug or proposal that is counter to the specification.
and removed
bug
A test is wrong, or tooling is broken or buggy.
labels
Aug 19, 2020
So after the merging of #360 which gave the resources unique names, I was able to test these tests against my implementation, and I got some failures. After closer examination I think the test is wrong, not my implementation:
The errors are in the schema with description "base URI change - change folder". Let's look at that schema:
and let's trace the evaluation path through the schema:
The error is that the uri at /properties/list/$ref should have a leading /, so it doesn't append to whatever existing path we already had in our base uri. When we first identify resources in this schema, the path component of the base uri is "/scope_change_defs1.json" -- there are no directory portions to use in the base, so resolving "baseUriChangeFolder/" against that gives us "/baseUriChangeFolder/" as the new base. But when we actually traverse the $ref and evaluate the subschema's $id, the base uri changes to "baseUriChangeFolder/" resolved against the base, which is "/baseUriChangeFolder/baseUriChangeFolder/".
If we're in agreement that this is an error, I can submit a one-character pull request that amends the uri reference at /$defs/baz/$id. If not, please explain why you disagree :)
cc @epoberezkin, who wrote the original test in commit a884acc (PR #160)
The text was updated successfully, but these errors were encountered: