-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Resolution of relative $ref with fragment #666
Comments
Could you, please, share an example of such a schema? It would help me a lot with fixing the issue |
Well, trying to prepare a minimal example got me completely confused now. The issue seems to depend on some execution order or something and is not as general as expected. Having a {
"$defs": {
"obj": {
"$ref": "other.json#/$defs/obj"
}
}
} and running jsonschema::validator_for(&json!({
"$id": "file:///tmp/schemas/root.json",
"$ref": "one.json#/$defs/obj"
}))
.unwrap(); There seems to be a 50:50 chance to get
or
(as I do not have that file) |
Ok, forget the confusion. In any case
json-schema:///other.json#/$defs/obj and file:///tmp/schemas/other.json#/$defs/obj . The error just depends on their order and when I add a /tmp/schemas/other.json with e.g.
{
"$defs": {
"obj": {
"type": "number"
}
}
} I always get the |
Follow up to #432 (comment) (Sorry, it was not #640 and unfortunately 0.28.1 / #665 does not fix it)
A relative
$ref
with a fragment likeother.json#/$defs/obj1
fails to resolve.Due to 4b34b75#diff-fd99d42493bf63977b4e2c0b1a10fdcef8528f837daee1a504d68d0b24186cf5L455-R475, the retriever gets passed
json-schema:///other.json
instead ofother.json
resolved against the$id
of the containing schema.The
if
branch added in that change might have just been a workaround for references starting with a fragment that #665 now handled inresolve_against
so that it's probably obsolete. It seems harmful for references not starting with a fragment, but containing one. I do not really understand whyDEFAULT_ROOT_URI
would ever be used over a present base.The text was updated successfully, but these errors were encountered: