Skip to content

Commit ef5cd2c

Browse files
committed
Test that $anchor applies to the nearest schema identifier only
The Core specification states the following: > The base URI to which the resulting fragment is appended is the > canonical URI of the schema resource containing the "$anchor" or > "$dynamicAnchor" in question. As discussed in the previous section, this > is either the nearest "$id" in the same or parent schema object, or the > base URI for the document as determined according to RFC 3986. See: https://json-schema.org/draft/2020-12/json-schema-core#section-8.2.2 Signed-off-by: Juan Cruz Viotti <[email protected]>
1 parent fbdfaa0 commit ef5cd2c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tests/json-schema-draft-2019-09/multiple-lookup-external-absolute-uri-with-different-id-anchor.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
"ref": "http://example.org/foo#baz",
3838
"target": { "$anchor": "baz", "quux": "eggs" }
3939
}
40+
},
41+
{
42+
"ref": "http://example.com/#baz",
43+
"error": true
4044
}
4145
]
4246
}

tests/json-schema-draft-2020-12/multiple-lookup-external-absolute-uri-with-different-id-anchor.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
"ref": "http://example.org/foo#baz",
3838
"target": { "$anchor": "baz", "quux": "eggs" }
3939
}
40+
},
41+
{
42+
"ref": "http://example.com/#baz",
43+
"error": true
4044
}
4145
]
4246
}

0 commit comments

Comments
 (0)