Skip to content

Commit 8a55721

Browse files
committed
Merge commit 'eb56578c253ff39b20986aabf48f34193be15457'
* commit 'eb56578c253ff39b20986aabf48f34193be15457': Squashed 'json/' changes from b069ac352..5cc9214e8
2 parents 4e999e0 + eb56578 commit 8a55721

File tree

14 files changed

+342
-56
lines changed

14 files changed

+342
-56
lines changed
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+
}
+13
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$id": "http://localhost:1234/draft2019-09/detached-ref.json",
3+
"$schema": "https://json-schema.org/draft/2019-09/schema",
4+
"$defs": {
5+
"foo": {
6+
"$ref": "#detached"
7+
},
8+
"detached": {
9+
"$anchor": "detached",
10+
"type": "integer"
11+
}
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$id": "http://localhost:1234/draft2020-12/detached-dynamicref.json",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"$defs": {
5+
"foo": {
6+
"$dynamicRef": "#detached"
7+
},
8+
"detached": {
9+
"$dynamicAnchor": "detached",
10+
"type": "integer"
11+
}
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$id": "http://localhost:1234/draft2020-12/detached-ref.json",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"$defs": {
5+
"foo": {
6+
"$ref": "#detached"
7+
},
8+
"detached": {
9+
"$anchor": "detached",
10+
"type": "integer"
11+
}
12+
}
13+
}

json/remotes/draft6/detached-ref.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$id": "http://localhost:1234/draft6/detached-ref.json",
3+
"$schema": "http://json-schema.org/draft-06/schema#",
4+
"definitions": {
5+
"foo": {
6+
"$ref": "#detached"
7+
},
8+
"detached": {
9+
"$id": "#detached",
10+
"type": "integer"
11+
}
12+
}
13+
}

json/remotes/draft7/detached-ref.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$id": "http://localhost:1234/draft7/detached-ref.json",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"definitions": {
5+
"foo": {
6+
"$ref": "#detached"
7+
},
8+
"detached": {
9+
"$id": "#detached",
10+
"type": "integer"
11+
}
12+
}
13+
}

json/tests/draft-next/dynamicRef.json

+76-28
Original file line numberDiff line numberDiff line change
@@ -207,45 +207,75 @@
207207
"schema": {
208208
"$schema": "https://json-schema.org/draft/next/schema",
209209
"$id": "https://test.json-schema.org/dynamic-ref-with-multiple-paths/main",
210-
"$defs": {
211-
"inner": {
212-
"$id": "inner",
213-
"$dynamicAnchor": "foo",
214-
"title": "inner",
215-
"additionalProperties": {
216-
"$dynamicRef": "#foo"
217-
}
210+
"propertyDependencies": {
211+
"kindOfList": {
212+
"numbers": { "$ref": "numberList" },
213+
"strings": { "$ref": "stringList" }
218214
}
219215
},
220-
"if": {
221-
"propertyNames": {
222-
"pattern": "^[a-m]"
216+
"$defs": {
217+
"genericList": {
218+
"$id": "genericList",
219+
"properties": {
220+
"list": {
221+
"items": { "$dynamicRef": "#itemType" }
222+
}
223+
}
224+
},
225+
"numberList": {
226+
"$id": "numberList",
227+
"$defs": {
228+
"itemType": {
229+
"$dynamicAnchor": "itemType",
230+
"type": "number"
231+
}
232+
},
233+
"$ref": "genericList"
234+
},
235+
"stringList": {
236+
"$id": "stringList",
237+
"$defs": {
238+
"itemType": {
239+
"$dynamicAnchor": "itemType",
240+
"type": "string"
241+
}
242+
},
243+
"$ref": "genericList"
223244
}
224-
},
225-
"then": {
226-
"title": "any type of node",
227-
"$id": "anyLeafNode",
228-
"$dynamicAnchor": "foo",
229-
"$ref": "inner"
230-
},
231-
"else": {
232-
"title": "integer node",
233-
"$id": "integerNode",
234-
"$dynamicAnchor": "foo",
235-
"type": [ "object", "integer" ],
236-
"$ref": "inner"
237245
}
238246
},
239247
"tests": [
240248
{
241-
"description": "recurse to anyLeafNode - floats are allowed",
242-
"data": { "alpha": 1.1 },
249+
"description": "number list with number values",
250+
"data": {
251+
"kindOfList": "numbers",
252+
"list": [1.1]
253+
},
243254
"valid": true
244255
},
245256
{
246-
"description": "recurse to integerNode - floats are not allowed",
247-
"data": { "november": 1.1 },
257+
"description": "number list with string values",
258+
"data": {
259+
"kindOfList": "numbers",
260+
"list": ["foo"]
261+
},
248262
"valid": false
263+
},
264+
{
265+
"description": "string list with number values",
266+
"data": {
267+
"kindOfList": "strings",
268+
"list": [1.1]
269+
},
270+
"valid": false
271+
},
272+
{
273+
"description": "string list with string values",
274+
"data": {
275+
"kindOfList": "strings",
276+
"list": ["foo"]
277+
},
278+
"valid": true
249279
}
250280
]
251281
},
@@ -564,5 +594,23 @@
564594
"valid": false
565595
}
566596
]
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+
]
567615
}
568616
]

json/tests/draft-next/refRemote.json

+18
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
]

json/tests/draft2019-09/refRemote.json

+18
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
]

0 commit comments

Comments
 (0)