Skip to content

Commit f8a5668

Browse files
dynamic $recursiveRef test with cousin $recursiveAnchors
1 parent 8a3a542 commit f8a5668

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

tests/draft2019-09/recursiveRef.json

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

0 commit comments

Comments
 (0)