Skip to content

Commit e93077e

Browse files
committed
Simplify test for dynamic ref with multiple paths
1 parent b069ac3 commit e93077e

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

tests/draft2020-12/dynamicRef.json

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -392,45 +392,61 @@
392392
"schema": {
393393
"$schema": "https://json-schema.org/draft/2020-12/schema",
394394
"$id": "https://test.json-schema.org/dynamic-ref-with-multiple-paths/main",
395-
"$defs": {
396-
"inner": {
397-
"$id": "inner",
398-
"$dynamicAnchor": "foo",
399-
"title": "inner",
400-
"additionalProperties": {
401-
"$dynamicRef": "#foo"
402-
}
403-
}
404-
},
405395
"if": {
406396
"propertyNames": {
407397
"pattern": "^[a-m]"
408398
}
409399
},
410400
"then": {
411-
"title": "any type of node",
412-
"$id": "anyLeafNode",
413-
"$dynamicAnchor": "foo",
401+
"$id": "numberValues",
402+
"$defs": {
403+
"foo": {
404+
"$dynamicAnchor": "foo",
405+
"type": "number"
406+
}
407+
},
414408
"$ref": "inner"
415409
},
416410
"else": {
417-
"title": "integer node",
418-
"$id": "integerNode",
419-
"$dynamicAnchor": "foo",
420-
"type": [ "object", "integer" ],
411+
"$id": "stringValues",
412+
"$defs": {
413+
"foo": {
414+
"$dynamicAnchor": "foo",
415+
"type": "string"
416+
}
417+
},
421418
"$ref": "inner"
419+
},
420+
"$defs": {
421+
"inner": {
422+
"$id": "inner",
423+
"$dynamicAnchor": "foo",
424+
"additionalProperties": {
425+
"$dynamicRef": "#foo"
426+
}
427+
}
422428
}
423429
},
424430
"tests": [
425431
{
426-
"description": "recurse to anyLeafNode - floats are allowed",
432+
"description": "alpha with number values",
427433
"data": { "alpha": 1.1 },
428434
"valid": true
429435
},
430436
{
431-
"description": "recurse to integerNode - floats are not allowed",
437+
"description": "alpha with string values",
438+
"data": { "alpha": "foo" },
439+
"valid": false
440+
},
441+
{
442+
"description": "november with number values",
432443
"data": { "november": 1.1 },
433444
"valid": false
445+
},
446+
{
447+
"description": "november with string values",
448+
"data": { "november": "foo" },
449+
"valid": true
434450
}
435451
]
436452
},

0 commit comments

Comments
 (0)