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
]

tests/draft2019-09/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/draft2019-09/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/draft2020-12/dynamicRef.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@
712712
{
713713
"description": "$ref to $dynamicRef finds detached $dynamicAnchor",
714714
"schema": {
715-
"$ref": "http://localhost:1234/draft2020-12/detached-dynamicref#/$defs/foo"
715+
"$ref": "http://localhost:1234/draft2020-12/detached-dynamicref.json#/$defs/foo"
716716
},
717717
"tests": [
718718
{

tests/draft2020-12/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/draft2020-12/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
]

tests/draft2020-12/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/draft2020-12/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/draft6/ref.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -925,23 +925,5 @@
925925
"valid": false
926926
}
927927
]
928-
},
929-
{
930-
"description": "$ref to $ref finds location-independent $id",
931-
"schema": {
932-
"$ref": "http://localhost:1234/draft6/detached-ref#/definitions/foo"
933-
},
934-
"tests": [
935-
{
936-
"description": "number is valid",
937-
"data": 1,
938-
"valid": true
939-
},
940-
{
941-
"description": "non-number is invalid",
942-
"data": "a",
943-
"valid": false
944-
}
945-
]
946928
}
947929
]

tests/draft6/refRemote.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,5 +235,23 @@
235235
"valid": true
236236
}
237237
]
238+
},
239+
{
240+
"description": "$ref to $ref finds location-independent $id",
241+
"schema": {
242+
"$ref": "http://localhost:1234/draft6/detached-ref.json#/definitions/foo"
243+
},
244+
"tests": [
245+
{
246+
"description": "number is valid",
247+
"data": 1,
248+
"valid": true
249+
},
250+
{
251+
"description": "non-number is invalid",
252+
"data": "a",
253+
"valid": false
254+
}
255+
]
238256
}
239257
]

tests/draft7/ref.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,23 +1039,5 @@
10391039
"valid": false
10401040
}
10411041
]
1042-
},
1043-
{
1044-
"description": "$ref to $ref finds location-independent $id",
1045-
"schema": {
1046-
"$ref": "http://localhost:1234/draft7/detached-ref#/definitions/foo"
1047-
},
1048-
"tests": [
1049-
{
1050-
"description": "number is valid",
1051-
"data": 1,
1052-
"valid": true
1053-
},
1054-
{
1055-
"description": "non-number is invalid",
1056-
"data": "a",
1057-
"valid": false
1058-
}
1059-
]
10601042
}
10611043
]

tests/draft7/refRemote.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,5 +235,23 @@
235235
"valid": true
236236
}
237237
]
238+
},
239+
{
240+
"description": "$ref to $ref finds location-independent $id",
241+
"schema": {
242+
"$ref": "http://localhost:1234/draft7/detached-ref.json#/definitions/foo"
243+
},
244+
"tests": [
245+
{
246+
"description": "number is valid",
247+
"data": 1,
248+
"valid": true
249+
},
250+
{
251+
"description": "non-number is invalid",
252+
"data": "a",
253+
"valid": false
254+
}
255+
]
238256
}
239257
]

0 commit comments

Comments
 (0)