Skip to content

Commit 0245dcc

Browse files
authored
Merge pull request #521 from olegshtch/add-recursive-ref-test-suite
Test $dynamicRef extensible tree
2 parents e9fb9cf + f1b230c commit 0245dcc

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

remotes/tree.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"description": "tree schema, extensible",
3+
"$id": "http://localhost:1234/tree.json",
4+
"$dynamicAnchor": "node",
5+
6+
"type": "object",
7+
"properties": {
8+
"data": true,
9+
"children": {
10+
"type": "array",
11+
"items": {
12+
"$dynamicRef": "#node"
13+
}
14+
}
15+
}
16+
}

tests/draft-future/dynamicRef.json

+30
Original file line numberDiff line numberDiff line change
@@ -441,5 +441,35 @@
441441
"valid": true
442442
}
443443
]
444+
},
445+
{
446+
"description": "strict-tree schema, guards against misspelled properties",
447+
"schema": {
448+
"$id": "http://localhost:1234/strict-tree.json",
449+
"$dynamicAnchor": "node",
450+
451+
"$ref": "tree.json",
452+
"unevaluatedProperties": false
453+
},
454+
"tests": [
455+
{
456+
"description": "instance with misspelled field",
457+
"data": {
458+
"children": [{
459+
"daat": 1
460+
}]
461+
},
462+
"valid": false
463+
},
464+
{
465+
"description": "instance with correct field",
466+
"data": {
467+
"children": [{
468+
"data": 1
469+
}]
470+
},
471+
"valid": true
472+
}
473+
]
444474
}
445475
]

tests/draft2020-12/dynamicRef.json

+30
Original file line numberDiff line numberDiff line change
@@ -441,5 +441,35 @@
441441
"valid": true
442442
}
443443
]
444+
},
445+
{
446+
"description": "strict-tree schema, guards against misspelled properties",
447+
"schema": {
448+
"$id": "http://localhost:1234/strict-tree.json",
449+
"$dynamicAnchor": "node",
450+
451+
"$ref": "tree.json",
452+
"unevaluatedProperties": false
453+
},
454+
"tests": [
455+
{
456+
"description": "instance with misspelled field",
457+
"data": {
458+
"children": [{
459+
"daat": 1
460+
}]
461+
},
462+
"valid": false
463+
},
464+
{
465+
"description": "instance with correct field",
466+
"data": {
467+
"children": [{
468+
"data": 1
469+
}]
470+
},
471+
"valid": true
472+
}
473+
]
444474
}
445475
]

0 commit comments

Comments
 (0)