cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft7/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 with boolean schemas, all true", 70 "schema": { 71 "anyOf": [ 72 true, 73 true 74 ] 75 }, 76 "tests": [ 77 { 78 "description": "any value is valid", 79 "data": "foo", 80 "valid": true 81 } 82 ] 83 }, 84 { 85 "description": "anyOf with boolean schemas, some true", 86 "schema": { 87 "anyOf": [ 88 true, 89 false 90 ] 91 }, 92 "tests": [ 93 { 94 "description": "any value is valid", 95 "data": "foo", 96 "valid": true 97 } 98 ] 99 }, 100 { 101 "description": "anyOf with boolean schemas, all false", 102 "schema": { 103 "anyOf": [ 104 false, 105 false 106 ] 107 }, 108 "tests": [ 109 { 110 "description": "any value is invalid", 111 "data": "foo", 112 "valid": false 113 } 114 ] 115 }, 116 { 117 "description": "anyOf complex types", 118 "schema": { 119 "anyOf": [ 120 { 121 "properties": { 122 "bar": { 123 "type": "integer" 124 } 125 }, 126 "required": [ 127 "bar" 128 ] 129 }, 130 { 131 "properties": { 132 "foo": { 133 "type": "string" 134 } 135 }, 136 "required": [ 137 "foo" 138 ] 139 } 140 ] 141 }, 142 "tests": [ 143 { 144 "description": "first anyOf valid (complex)", 145 "data": { 146 "bar": 2 147 }, 148 "valid": true 149 }, 150 { 151 "description": "second anyOf valid (complex)", 152 "data": { 153 "foo": "baz" 154 }, 155 "valid": true 156 }, 157 { 158 "description": "both anyOf valid (complex)", 159 "data": { 160 "foo": "baz", 161 "bar": 2 162 }, 163 "valid": true 164 }, 165 { 166 "description": "neither anyOf valid (complex)", 167 "data": { 168 "foo": 2, 169 "bar": "quux" 170 }, 171 "valid": false 172 } 173 ] 174 }, 175 { 176 "description": "anyOf with one empty schema", 177 "schema": { 178 "anyOf": [ 179 { 180 "type": "number" 181 }, 182 {} 183 ] 184 }, 185 "tests": [ 186 { 187 "description": "string is valid", 188 "data": "foo", 189 "valid": true 190 }, 191 { 192 "description": "number is valid", 193 "data": 123, 194 "valid": true 195 } 196 ] 197 }, 198 { 199 "description": "nested anyOf, to check validation semantics", 200 "schema": { 201 "anyOf": [ 202 { 203 "anyOf": [ 204 { 205 "type": "null" 206 } 207 ] 208 } 209 ] 210 }, 211 "tests": [ 212 { 213 "description": "null is valid", 214 "data": null, 215 "valid": true 216 }, 217 { 218 "description": "anything non-null is invalid", 219 "data": 123, 220 "valid": false 221 } 222 ] 223 } 224 ]