Skip to content

Commit b069ac3

Browse files
committed
Add tests for non-relative URI anchor referencing
1 parent 7950d9e commit b069ac3

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

tests/draft6/ref.json

+27
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,33 @@
445445
}
446446
]
447447
},
448+
{
449+
"description": "Reference an anchor with a non-relative URI",
450+
"schema": {
451+
"$id": "https://example.com/schema-with-anchor",
452+
"allOf": [{
453+
"$ref": "https://example.com/schema-with-anchor#foo"
454+
}],
455+
"definitions": {
456+
"A": {
457+
"$id": "#foo",
458+
"type": "integer"
459+
}
460+
}
461+
},
462+
"tests": [
463+
{
464+
"data": 1,
465+
"description": "match",
466+
"valid": true
467+
},
468+
{
469+
"data": "a",
470+
"description": "mismatch",
471+
"valid": false
472+
}
473+
]
474+
},
448475
{
449476
"description": "Location-independent identifier with base URI change in subschema",
450477
"schema": {

tests/draft7/ref.json

+27
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,33 @@
445445
}
446446
]
447447
},
448+
{
449+
"description": "Reference an anchor with a non-relative URI",
450+
"schema": {
451+
"$id": "https://example.com/schema-with-anchor",
452+
"allOf": [{
453+
"$ref": "https://example.com/schema-with-anchor#foo"
454+
}],
455+
"definitions": {
456+
"A": {
457+
"$id": "#foo",
458+
"type": "integer"
459+
}
460+
}
461+
},
462+
"tests": [
463+
{
464+
"data": 1,
465+
"description": "match",
466+
"valid": true
467+
},
468+
{
469+
"data": "a",
470+
"description": "mismatch",
471+
"valid": false
472+
}
473+
]
474+
},
448475
{
449476
"description": "Location-independent identifier with base URI change in subschema",
450477
"schema": {

0 commit comments

Comments
 (0)