|
26 | 26 | } |
27 | 27 | ] |
28 | 28 | }, |
29 | | - { |
30 | | - "description": "A $ref to a $dynamicAnchor in the same schema resource behaves like a normal $ref to an $anchor", |
31 | | - "schema": { |
32 | | - "$schema": "https://json-schema.org/v1", |
33 | | - "$id": "https://test.json-schema.org/ref-dynamicAnchor-same-schema/root", |
34 | | - "type": "array", |
35 | | - "items": { "$ref": "#items" }, |
36 | | - "$defs": { |
37 | | - "foo": { |
38 | | - "$dynamicAnchor": "items", |
39 | | - "type": "string" |
40 | | - } |
41 | | - } |
42 | | - }, |
43 | | - "tests": [ |
44 | | - { |
45 | | - "description": "An array of strings is valid", |
46 | | - "data": ["foo", "bar"], |
47 | | - "valid": true |
48 | | - }, |
49 | | - { |
50 | | - "description": "An array containing non-strings is invalid", |
51 | | - "data": ["foo", 42], |
52 | | - "valid": false |
53 | | - } |
54 | | - ] |
55 | | - }, |
56 | 29 | { |
57 | 30 | "description": "A $dynamicRef resolves to the first $dynamicAnchor still in scope that is encountered when the schema is evaluated", |
58 | 31 | "schema": { |
|
150 | 123 | } |
151 | 124 | ] |
152 | 125 | }, |
153 | | - { |
154 | | - "description": "A $dynamicRef that initially resolves to a schema with a matching $dynamicAnchor resolves to the first $dynamicAnchor in the dynamic scope", |
155 | | - "schema": { |
156 | | - "$schema": "https://json-schema.org/v1", |
157 | | - "$id": "https://test.json-schema.org/relative-dynamic-reference/root", |
158 | | - "$dynamicAnchor": "meta", |
159 | | - "type": "object", |
160 | | - "properties": { |
161 | | - "foo": { "const": "pass" } |
162 | | - }, |
163 | | - "$ref": "extended", |
164 | | - "$defs": { |
165 | | - "extended": { |
166 | | - "$id": "extended", |
167 | | - "$dynamicAnchor": "meta", |
168 | | - "type": "object", |
169 | | - "properties": { |
170 | | - "bar": { "$ref": "bar" } |
171 | | - } |
172 | | - }, |
173 | | - "bar": { |
174 | | - "$id": "bar", |
175 | | - "type": "object", |
176 | | - "properties": { |
177 | | - "baz": { "$dynamicRef": "extended#meta" } |
178 | | - } |
179 | | - } |
180 | | - } |
181 | | - }, |
182 | | - "tests": [ |
183 | | - { |
184 | | - "description": "The recursive part is valid against the root", |
185 | | - "data": { |
186 | | - "foo": "pass", |
187 | | - "bar": { |
188 | | - "baz": { "foo": "pass" } |
189 | | - } |
190 | | - }, |
191 | | - "valid": true |
192 | | - }, |
193 | | - { |
194 | | - "description": "The recursive part is not valid against the root", |
195 | | - "data": { |
196 | | - "foo": "pass", |
197 | | - "bar": { |
198 | | - "baz": { "foo": "fail" } |
199 | | - } |
200 | | - }, |
201 | | - "valid": false |
202 | | - } |
203 | | - ] |
204 | | - }, |
205 | 126 | { |
206 | 127 | "description": "multiple dynamic paths to the $dynamicRef keyword", |
207 | 128 | "schema": { |
|
282 | 203 | { |
283 | 204 | "description": "after leaving a dynamic scope, it is not used by a $dynamicRef", |
284 | 205 | "schema": { |
285 | | - "$schema": "https://json-schema.org/v1", |
286 | 206 | "$id": "https://test.json-schema.org/dynamic-ref-leaving-dynamic-scope/main", |
287 | 207 | "if": { |
288 | 208 | "$id": "first_scope", |
|
309 | 229 | "start": { |
310 | 230 | "$comment": "this is the landing spot from $ref", |
311 | 231 | "$id": "start", |
312 | | - "$dynamicRef": "inner_scope#thingy" |
| 232 | + "$ref": "inner_scope" |
313 | 233 | }, |
314 | 234 | "thingy": { |
315 | | - "$comment": "this is the first stop for the $dynamicRef", |
316 | 235 | "$id": "inner_scope", |
317 | | - "$dynamicAnchor": "thingy", |
318 | | - "type": "string" |
| 236 | + "$dynamicRef": "#thingy", |
| 237 | + "$defs": { |
| 238 | + "": { |
| 239 | + "$comment": "this is the first stop for the $dynamicRef", |
| 240 | + "$dynamicAnchor": "thingy", |
| 241 | + "type": "string" |
| 242 | + } |
| 243 | + } |
319 | 244 | } |
320 | 245 | } |
321 | 246 | }, |
|
613 | 538 | } |
614 | 539 | ] |
615 | 540 | }, |
616 | | - { |
617 | | - "description": "$dynamicRef points to a boolean schema", |
618 | | - "schema": { |
619 | | - "$schema": "https://json-schema.org/v1", |
620 | | - "$defs": { |
621 | | - "true": true, |
622 | | - "false": false |
623 | | - }, |
624 | | - "properties": { |
625 | | - "true": { |
626 | | - "$dynamicRef": "#/$defs/true" |
627 | | - }, |
628 | | - "false": { |
629 | | - "$dynamicRef": "#/$defs/false" |
630 | | - } |
631 | | - } |
632 | | - }, |
633 | | - "tests": [ |
634 | | - { |
635 | | - "description": "follow $dynamicRef to a true schema", |
636 | | - "data": { "true": 1 }, |
637 | | - "valid": true |
638 | | - }, |
639 | | - { |
640 | | - "description": "follow $dynamicRef to a false schema", |
641 | | - "data": { "false": 1 }, |
642 | | - "valid": false |
643 | | - } |
644 | | - ] |
645 | | - }, |
646 | 541 | { |
647 | 542 | "description": "$dynamicRef skips over intermediate resources - direct reference", |
648 | 543 | "schema": { |
|
0 commit comments