Skip to content

Commit 5cc9214

Browse files
authored
Merge pull request #681 from json-schema-org/gregsdennis/ref-to-ref-to-non-local-target
update previous test set to consistently use file extensions; add to draft-next
2 parents a0097d4 + c946d36 commit 5cc9214

File tree

18 files changed

+140
-78
lines changed

18 files changed

+140
-78
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$id": "http://localhost:1234/draft-next/detached-dynamicref.json",
3+
"$schema": "https://json-schema.org/draft/next/schema",
4+
"$defs": {
5+
"foo": {
6+
"$dynamicRef": "#detached"
7+
},
8+
"detached": {
9+
"$dynamicAnchor": "detached",
10+
"type": "integer"
11+
}
12+
}
13+
}

remotes/draft-next/detached-ref.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$id": "http://localhost:1234/draft-next/detached-ref.json",
3+
"$schema": "https://json-schema.org/draft/next/schema",
4+
"$defs": {
5+
"foo": {
6+
"$ref": "#detached"
7+
},
8+
"detached": {
9+
"$anchor": "detached",
10+
"type": "integer"
11+
}
12+
}
13+
}

remotes/draft2019-09/detached-ref.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "http://localhost:1234/draft2019-09/detached-ref",
2+
"$id": "http://localhost:1234/draft2019-09/detached-ref.json",
33
"$schema": "https://json-schema.org/draft/2019-09/schema",
44
"$defs": {
55
"foo": {

remotes/draft2020-12/detached-dynamicref.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "http://localhost:1234/draft2020-12/detached-dynamicref",
2+
"$id": "http://localhost:1234/draft2020-12/detached-dynamicref.json",
33
"$schema": "https://json-schema.org/draft/2020-12/schema",
44
"$defs": {
55
"foo": {

remotes/draft2020-12/detached-ref.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "http://localhost:1234/draft2020-12/detached-ref",
2+
"$id": "http://localhost:1234/draft2020-12/detached-ref.json",
33
"$schema": "https://json-schema.org/draft/2020-12/schema",
44
"$defs": {
55
"foo": {

remotes/draft6/detached-ref.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "http://localhost:1234/draft6/detached-ref",
2+
"$id": "http://localhost:1234/draft6/detached-ref.json",
33
"$schema": "http://json-schema.org/draft-06/schema#",
44
"definitions": {
55
"foo": {

remotes/draft7/detached-ref.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "http://localhost:1234/draft7/detached-ref",
2+
"$id": "http://localhost:1234/draft7/detached-ref.json",
33
"$schema": "http://json-schema.org/draft-07/schema#",
44
"definitions": {
55
"foo": {

tests/draft-next/dynamicRef.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,5 +594,23 @@
594594
"valid": false
595595
}
596596
]
597+
},
598+
{
599+
"description": "$ref to $dynamicRef finds detached $dynamicAnchor",
600+
"schema": {
601+
"$ref": "http://localhost:1234/draft-next/detached-dynamicref.json#/$defs/foo"
602+
},
603+
"tests": [
604+
{
605+
"description": "number is valid",
606+
"data": 1,
607+
"valid": true
608+
},
609+
{
610+
"description": "non-number is invalid",
611+
"data": "a",
612+
"valid": false
613+
}
614+
]
597615
}
598616
]

tests/draft-next/refRemote.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,5 +310,23 @@
310310
"valid": true
311311
}
312312
]
313+
},
314+
{
315+
"description": "$ref to $ref finds detached $anchor",
316+
"schema": {
317+
"$ref": "http://localhost:1234/draft-next/detached-ref.json#/$defs/foo"
318+
},
319+
"tests": [
320+
{
321+
"description": "number is valid",
322+
"data": 1,
323+
"valid": true
324+
},
325+
{
326+
"description": "non-number is invalid",
327+
"data": "a",
328+
"valid": false
329+
}
330+
]
313331
}
314332
]

tests/draft2019-09/ref.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,23 +1055,5 @@
10551055
"valid": false
10561056
}
10571057
]
1058-
},
1059-
{
1060-
"description": "$ref to $ref finds detached $anchor",
1061-
"schema": {
1062-
"$ref": "http://localhost:1234/draft2019-09/detached-ref#/$defs/foo"
1063-
},
1064-
"tests": [
1065-
{
1066-
"description": "number is valid",
1067-
"data": 1,
1068-
"valid": true
1069-
},
1070-
{
1071-
"description": "non-number is invalid",
1072-
"data": "a",
1073-
"valid": false
1074-
}
1075-
]
10761058
}
10771059
]

0 commit comments

Comments
 (0)