Skip to content

Commit eaa5bff

Browse files
Merge pull request #489 from json-schema-org/ether/more-recursiveRef
dynamic $recursiveRef test with cousin $recursiveAnchors
2 parents 8a3a542 + 7c33b53 commit eaa5bff

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/draft2019-09/recursiveRef.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,5 +352,48 @@
352352
"valid": false
353353
}
354354
]
355+
},
356+
{
357+
"description": "dynamic $recursiveRef destination (not predictable at schema compile time)",
358+
"schema": {
359+
"$id": "main.json",
360+
"$defs": {
361+
"inner": {
362+
"$id": "inner.json",
363+
"$recursiveAnchor": true,
364+
"title": "inner",
365+
"additionalProperties": {
366+
"$recursiveRef": "#"
367+
}
368+
}
369+
370+
},
371+
"if": { "propertyNames": { "pattern": "^[a-m]" } },
372+
"then": {
373+
"title": "any type of node",
374+
"$id": "anyLeafNode.json",
375+
"$recursiveAnchor": true,
376+
"$ref": "main.json#/$defs/inner"
377+
},
378+
"else": {
379+
"title": "integer node",
380+
"$id": "integerNode.json",
381+
"$recursiveAnchor": true,
382+
"type": [ "object", "integer" ],
383+
"$ref": "main.json#/$defs/inner"
384+
}
385+
},
386+
"tests": [
387+
{
388+
"description": "numeric node",
389+
"data": { "alpha": 1.1 },
390+
"valid": true
391+
},
392+
{
393+
"description": "integer node",
394+
"data": { "november": 1.1 },
395+
"valid": false
396+
}
397+
]
355398
}
356399
]

0 commit comments

Comments
 (0)