Skip to content

Commit 8cdfac4

Browse files
committed
Port new multiple dynamic paths test to draft-next
1 parent cd441d2 commit 8cdfac4

File tree

1 file changed

+58
-28
lines changed

1 file changed

+58
-28
lines changed

tests/draft-next/dynamicRef.json

Lines changed: 58 additions & 28 deletions
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
},

0 commit comments

Comments
 (0)