cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft4/anyOf.json (about) 1 [ 2 { 3 "description": "anyOf", 4 "schema": { 5 "anyOf": [ 6 { 7 "type": "integer" 8 }, 9 { 10 "minimum": 2 11 } 12 ] 13 }, 14 "tests": [ 15 { 16 "description": "first anyOf valid", 17 "data": 1, 18 "valid": true 19 }, 20 { 21 "description": "second anyOf valid", 22 "data": 2.5, 23 "valid": true 24 }, 25 { 26 "description": "both anyOf valid", 27 "data": 3, 28 "valid": true 29 }, 30 { 31 "description": "neither anyOf valid", 32 "data": 1.5, 33 "valid": false 34 } 35 ] 36 }, 37 { 38 "description": "anyOf with base schema", 39 "schema": { 40 "type": "string", 41 "anyOf": [ 42 { 43 "maxLength": 2 44 }, 45 { 46 "minLength": 4 47 } 48 ] 49 }, 50 "tests": [ 51 { 52 "description": "mismatch base schema", 53 "data": 3, 54 "valid": false 55 }, 56 { 57 "description": "one anyOf valid", 58 "data": "foobar", 59 "valid": true 60 }, 61 { 62 "description": "both anyOf invalid", 63 "data": "foo", 64 "valid": false 65 } 66 ] 67 }, 68 { 69 "description": "anyOf complex types", 70 "schema": { 71 "anyOf": [ 72 { 73 "properties": { 74 "bar": { 75 "type": "integer" 76 } 77 }, 78 "required": [ 79 "bar" 80 ] 81 }, 82 { 83 "properties": { 84 "foo": { 85 "type": "string" 86 } 87 }, 88 "required": [ 89 "foo" 90 ] 91 } 92 ] 93 }, 94 "tests": [ 95 { 96 "description": "first anyOf valid (complex)", 97 "data": { 98 "bar": 2 99 }, 100 "valid": true 101 }, 102 { 103 "description": "second anyOf valid (complex)", 104 "data": { 105 "foo": "baz" 106 }, 107 "valid": true 108 }, 109 { 110 "description": "both anyOf valid (complex)", 111 "data": { 112 "foo": "baz", 113 "bar": 2 114 }, 115 "valid": true 116 }, 117 { 118 "description": "neither anyOf valid (complex)", 119 "data": { 120 "foo": 2, 121 "bar": "quux" 122 }, 123 "valid": false 124 } 125 ] 126 }, 127 { 128 "description": "anyOf with one empty schema", 129 "schema": { 130 "anyOf": [ 131 { 132 "type": "number" 133 }, 134 {} 135 ] 136 }, 137 "tests": [ 138 { 139 "description": "string is valid", 140 "data": "foo", 141 "valid": true 142 }, 143 { 144 "description": "number is valid", 145 "data": 123, 146 "valid": true 147 } 148 ] 149 }, 150 { 151 "description": "nested anyOf, to check validation semantics", 152 "schema": { 153 "anyOf": [ 154 { 155 "anyOf": [ 156 { 157 "type": "null" 158 } 159 ] 160 } 161 ] 162 }, 163 "tests": [ 164 { 165 "description": "null is valid", 166 "data": null, 167 "valid": true 168 }, 169 { 170 "description": "anything non-null is invalid", 171 "data": 123, 172 "valid": false 173 } 174 ] 175 } 176 ]