github.com/kaptinlin/jsonschema@v0.4.6/testdata/JSON-Schema-Test-Suite/tests/draft7/optional/id.json (about) 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 "definitions": { 7 "id_in_enum": { 8 "enum": [ 9 { 10 "$id": "https://localhost:1234/id/my_identifier.json", 11 "type": "null" 12 } 13 ] 14 }, 15 "real_id_in_schema": { 16 "$id": "https://localhost:1234/id/my_identifier.json", 17 "type": "string" 18 }, 19 "zzz_id_in_const": { 20 "const": { 21 "$id": "https://localhost:1234/id/my_identifier.json", 22 "type": "null" 23 } 24 } 25 }, 26 "anyOf": [ 27 { "$ref": "#/definitions/id_in_enum" }, 28 { "$ref": "https://localhost:1234/id/my_identifier.json" } 29 ] 30 }, 31 "tests": [ 32 { 33 "description": "exact match to enum, and type matches", 34 "data": { 35 "$id": "https://localhost:1234/id/my_identifier.json", 36 "type": "null" 37 }, 38 "valid": true 39 }, 40 { 41 "description": "match $ref to id", 42 "data": "a string to match #/definitions/id_in_enum", 43 "valid": true 44 }, 45 { 46 "description": "no match on enum or $ref to id", 47 "data": 1, 48 "valid": false 49 } 50 ] 51 }, 52 { 53 "description": "non-schema object containing a plain-name $id property", 54 "schema": { 55 "definitions": { 56 "const_not_anchor": { 57 "const": { 58 "$id": "#not_a_real_anchor" 59 } 60 } 61 }, 62 "if": { 63 "const": "skip not_a_real_anchor" 64 }, 65 "then": true, 66 "else" : { 67 "$ref": "#/definitions/const_not_anchor" 68 } 69 }, 70 "tests": [ 71 { 72 "description": "skip traversing definition for a valid result", 73 "data": "skip not_a_real_anchor", 74 "valid": true 75 }, 76 { 77 "description": "const at const_not_anchor does not match", 78 "data": 1, 79 "valid": false 80 } 81 ] 82 }, 83 { 84 "description": "non-schema object containing an $id property", 85 "schema": { 86 "definitions": { 87 "const_not_id": { 88 "const": { 89 "$id": "not_a_real_id" 90 } 91 } 92 }, 93 "if": { 94 "const": "skip not_a_real_id" 95 }, 96 "then": true, 97 "else" : { 98 "$ref": "#/definitions/const_not_id" 99 } 100 }, 101 "tests": [ 102 { 103 "description": "skip traversing definition for a valid result", 104 "data": "skip not_a_real_id", 105 "valid": true 106 }, 107 { 108 "description": "const at const_not_id does not match", 109 "data": 1, 110 "valid": false 111 } 112 ] 113 } 114 ]