|
25 | 25 | } |
26 | 26 | ] |
27 | 27 | }, |
28 | | - { |
29 | | - "description": "A $dynamicRef to an $anchor in the same schema resource should behave like a normal $ref to an $anchor", |
30 | | - "schema": { |
31 | | - "$id": "https://test.json-schema.org/dynamicRef-anchor-same-schema/root", |
32 | | - "type": "array", |
33 | | - "items": { "$dynamicRef": "#items" }, |
34 | | - "$defs": { |
35 | | - "foo": { |
36 | | - "$anchor": "items", |
37 | | - "type": "string" |
38 | | - } |
39 | | - } |
40 | | - }, |
41 | | - "tests": [ |
42 | | - { |
43 | | - "description": "An array of strings is valid", |
44 | | - "data": ["foo", "bar"], |
45 | | - "valid": true |
46 | | - }, |
47 | | - { |
48 | | - "description": "An array containing non-strings is invalid", |
49 | | - "data": ["foo", 42], |
50 | | - "valid": false |
51 | | - } |
52 | | - ] |
53 | | - }, |
54 | 28 | { |
55 | 29 | "description": "A $ref to a $dynamicAnchor in the same schema resource should behave like a normal $ref to an $anchor", |
56 | 30 | "schema": { |
|
90 | 64 | "list": { |
91 | 65 | "$id": "list", |
92 | 66 | "type": "array", |
93 | | - "items": { "$dynamicRef": "#items" }, |
94 | | - "$defs": { |
95 | | - "items": { |
96 | | - "$comment": "This is only needed to satisfy the bookending requirement", |
97 | | - "$dynamicAnchor": "items" |
98 | | - } |
99 | | - } |
| 67 | + "items": { "$dynamicRef": "#items" } |
100 | 68 | } |
101 | 69 | } |
102 | 70 | }, |
|
130 | 98 | "list": { |
131 | 99 | "$id": "list", |
132 | 100 | "type": "array", |
133 | | - "items": { "$dynamicRef": "#items" }, |
134 | | - "$defs": { |
135 | | - "items": { |
136 | | - "$comment": "This is only needed to satisfy the bookending requirement", |
137 | | - "$dynamicAnchor": "items" |
138 | | - } |
139 | | - } |
| 101 | + "items": { "$dynamicRef": "#items" } |
140 | 102 | } |
141 | 103 | } |
142 | 104 | }, |
|
169 | 131 | "items": { "$dynamicRef": "#items" }, |
170 | 132 | "$defs": { |
171 | 133 | "items": { |
172 | | - "$comment": "This is only needed to satisfy the bookending requirement", |
173 | 134 | "$dynamicAnchor": "items" |
174 | 135 | } |
175 | 136 | } |
|
184 | 145 | } |
185 | 146 | ] |
186 | 147 | }, |
187 | | - { |
188 | | - "description": "A $dynamicRef without a matching $dynamicAnchor in the same schema resource should behave like a normal $ref to $anchor", |
189 | | - "schema": { |
190 | | - "$id": "https://test.json-schema.org/dynamic-resolution-without-bookend/root", |
191 | | - "$ref": "list", |
192 | | - "$defs": { |
193 | | - "foo": { |
194 | | - "$dynamicAnchor": "items", |
195 | | - "type": "string" |
196 | | - }, |
197 | | - "list": { |
198 | | - "$id": "list", |
199 | | - "type": "array", |
200 | | - "items": { "$dynamicRef": "#items" }, |
201 | | - "$defs": { |
202 | | - "items": { |
203 | | - "$comment": "This is only needed to give the reference somewhere to resolve to when it behaves like $ref", |
204 | | - "$anchor": "items" |
205 | | - } |
206 | | - } |
207 | | - } |
208 | | - } |
209 | | - }, |
210 | | - "tests": [ |
211 | | - { |
212 | | - "description": "Any array is valid", |
213 | | - "data": ["foo", 42], |
214 | | - "valid": true |
215 | | - } |
216 | | - ] |
217 | | - }, |
218 | | - { |
219 | | - "description": "A $dynamicRef with a non-matching $dynamicAnchor in the same schema resource should behave like a normal $ref to $anchor", |
220 | | - "schema": { |
221 | | - "$id": "https://test.json-schema.org/unmatched-dynamic-anchor/root", |
222 | | - "$ref": "list", |
223 | | - "$defs": { |
224 | | - "foo": { |
225 | | - "$dynamicAnchor": "items", |
226 | | - "type": "string" |
227 | | - }, |
228 | | - "list": { |
229 | | - "$id": "list", |
230 | | - "type": "array", |
231 | | - "items": { "$dynamicRef": "#items" }, |
232 | | - "$defs": { |
233 | | - "items": { |
234 | | - "$comment": "This is only needed to give the reference somewhere to resolve to when it behaves like $ref", |
235 | | - "$anchor": "items", |
236 | | - "$dynamicAnchor": "foo" |
237 | | - } |
238 | | - } |
239 | | - } |
240 | | - } |
241 | | - }, |
242 | | - "tests": [ |
243 | | - { |
244 | | - "description": "Any array is valid", |
245 | | - "data": ["foo", 42], |
246 | | - "valid": true |
247 | | - } |
248 | | - ] |
249 | | - }, |
250 | 148 | { |
251 | 149 | "description": "A $dynamicRef that initially resolves to a schema with a matching $dynamicAnchor should resolve to the first $dynamicAnchor in the dynamic scope", |
252 | 150 | "schema": { |
|
298 | 196 | } |
299 | 197 | ] |
300 | 198 | }, |
301 | | - { |
302 | | - "description": "A $dynamicRef that initially resolves to a schema without a matching $dynamicAnchor should behave like a normal $ref to $anchor", |
303 | | - "schema": { |
304 | | - "$id": "https://test.json-schema.org/relative-dynamic-reference-without-bookend/root", |
305 | | - "$dynamicAnchor": "meta", |
306 | | - "type": "object", |
307 | | - "properties": { |
308 | | - "foo": { "const": "pass" } |
309 | | - }, |
310 | | - "$ref": "extended", |
311 | | - "$defs": { |
312 | | - "extended": { |
313 | | - "$id": "extended", |
314 | | - "$anchor": "meta", |
315 | | - "type": "object", |
316 | | - "properties": { |
317 | | - "bar": { "$ref": "bar" } |
318 | | - } |
319 | | - }, |
320 | | - "bar": { |
321 | | - "$id": "bar", |
322 | | - "type": "object", |
323 | | - "properties": { |
324 | | - "baz": { "$dynamicRef": "extended#meta" } |
325 | | - } |
326 | | - } |
327 | | - } |
328 | | - }, |
329 | | - "tests": [ |
330 | | - { |
331 | | - "description": "The recursive part doesn't need to validate against the root", |
332 | | - "data": { |
333 | | - "foo": "pass", |
334 | | - "bar": { |
335 | | - "baz": { "foo": "fail" } |
336 | | - } |
337 | | - }, |
338 | | - "valid": true |
339 | | - } |
340 | | - ] |
341 | | - }, |
342 | 199 | { |
343 | 200 | "description": "multiple dynamic paths to the $dynamicRef keyword", |
344 | 201 | "schema": { |
|
0 commit comments