-
-
Notifications
You must be signed in to change notification settings - Fork 224
Description
Prompted by networknt/json-schema-validator#1200 - relevant details copied below.
Suppose http://example.com/schemas/v3/bundle.json
resolves to the following Compound Schema Document:
{
"$defs": {
"http://example.com/schemas/v3/component/foo": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://example.com/schemas/v3/component/foo",
"type": "object",
"properties": { "bar": { "$ref": "./bar" } }
},
"http://example.com/schemas/v3/component/bar": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://example.com/schemas/v3/component/bar",
"$ref": "./baz",
"unevaluatedProperties": false
},
"http://example.com/schemas/v3/component/baz": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://example.com/schemas/v3/component/baz",
"type": "object",
"properties": { "bat": { "type": "string" } }
}
}
}
The $ref
from http://example.com/schemas/v3/component/foo
to "./bar" is resolves to http://example.com/schemas/v3/component/bar
.
Based on the "$ref prevents a sibling $id from changing the base uri" test, the NetworkNT validator resolves the $ref: "./baz"
in http://example.com/schemas/v3/component/bar
relative to the parent schema, returning http://example.com/schemas/v3/bat
instead of http://example.com/schemas/v3/component/bat
which I would expect.
I notice that this test is present in older versions but has been removed in draft 2019-09 and draft 2020-12.
What is the intended behaviour, and would it be possible to get a test added to clarify this?