Skip to content

Commit 4503eea

Browse files
test: A $dynamicRef without anchor in fragment behaves identical to $ref
1 parent fd80307 commit 4503eea

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/draft2020-12/dynamicRef.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,44 @@
117117
}
118118
]
119119
},
120+
{
121+
"description": "A $dynamicRef without anchor in fragment behaves identical to $ref",
122+
"schema": {
123+
"$schema": "https://json-schema.org/draft/2020-12/schema",
124+
"$id": "https://test.json-schema.org/dynamicRef-without-anchor/root",
125+
"$ref": "list",
126+
"$defs": {
127+
"foo": {
128+
"$dynamicAnchor": "items",
129+
"type": "string"
130+
},
131+
"list": {
132+
"$id": "list",
133+
"type": "array",
134+
"items": { "$dynamicRef": "#/$defs/items" },
135+
"$defs": {
136+
"items": {
137+
"$comment": "This is only needed to satisfy the bookending requirement",
138+
"$dynamicAnchor": "items",
139+
"type": "number"
140+
}
141+
}
142+
}
143+
}
144+
},
145+
"tests": [
146+
{
147+
"description": "An array of strings is invalid",
148+
"data": ["foo", "bar"],
149+
"valid": false
150+
},
151+
{
152+
"description": "An array of numbers is valid",
153+
"data": [24, 42],
154+
"valid": true
155+
}
156+
]
157+
},
120158
{
121159
"description": "A $dynamicRef with intermediate scopes that don't include a matching $dynamicAnchor does not affect dynamic scope resolution",
122160
"schema": {

0 commit comments

Comments
 (0)