Debian Codegraph @

share/tests/draft2020-12/optional/id.json

raw
1 [
2 {
3 "description": "$id inside an enum is not a real identifier",
4 "comment": "the implementation must not be confused by an $id buried in the enum",
5 "schema": {
6 "$schema": "https://json-schema.org/draft/2020-12/schema",
7 "$defs": {
8 "id_in_enum": {
9 "enum": [
10 {
11 "$id": "https://localhost:1234/draft2020-12/id/my_identifier.json",
12 "type": "null"
13 }
14 ]
15 },
16 "real_id_in_schema": {
17 "$id": "https://localhost:1234/draft2020-12/id/my_identifier.json",
18 "type": "string"
19 },
20 "zzz_id_in_const": {
21 "const": {
22 "$id": "https://localhost:1234/draft2020-12/id/my_identifier.json",
23 "type": "null"
24 }
25 }
26 },
27 "anyOf": [
28 { "$ref": "#/$defs/id_in_enum" },
29 { "$ref": "https://localhost:1234/draft2020-12/id/my_identifier.json" }
30 ]
31 },
32 "tests": [
33 {
34 "description": "exact match to enum, and type matches",
35 "data": {
36 "$id": "https://localhost:1234/draft2020-12/id/my_identifier.json",
37 "type": "null"
38 },
39 "valid": true
40 },
41 {
42 "description": "match $ref to $id",
43 "data": "a string to match #/$defs/id_in_enum",
44 "valid": true
45 },
46 {
47 "description": "no match on enum or $ref to $id",
48 "data": 1,
49 "valid": false
50 }
51 ]
52 }
53 ]