cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft2020-12/not.json (about) 1 [ 2 { 3 "description": "not", 4 "schema": { 5 "$schema": "https://json-schema.org/draft/2020-12/schema", 6 "not": { 7 "type": "integer" 8 } 9 }, 10 "tests": [ 11 { 12 "description": "allowed", 13 "data": "foo", 14 "valid": true 15 }, 16 { 17 "description": "disallowed", 18 "data": 1, 19 "valid": false 20 } 21 ] 22 }, 23 { 24 "description": "not multiple types", 25 "schema": { 26 "$schema": "https://json-schema.org/draft/2020-12/schema", 27 "not": { 28 "type": [ 29 "integer", 30 "boolean" 31 ] 32 } 33 }, 34 "tests": [ 35 { 36 "description": "valid", 37 "data": "foo", 38 "valid": true 39 }, 40 { 41 "description": "mismatch", 42 "data": 1, 43 "valid": false 44 }, 45 { 46 "description": "other mismatch", 47 "data": true, 48 "valid": false 49 } 50 ] 51 }, 52 { 53 "description": "not more complex schema", 54 "schema": { 55 "$schema": "https://json-schema.org/draft/2020-12/schema", 56 "not": { 57 "type": "object", 58 "properties": { 59 "foo": { 60 "type": "string" 61 } 62 } 63 } 64 }, 65 "tests": [ 66 { 67 "description": "match", 68 "data": 1, 69 "valid": true 70 }, 71 { 72 "description": "other match", 73 "data": { 74 "foo": 1 75 }, 76 "valid": true 77 }, 78 { 79 "description": "mismatch", 80 "data": { 81 "foo": "bar" 82 }, 83 "valid": false 84 } 85 ] 86 }, 87 { 88 "description": "forbidden property", 89 "schema": { 90 "$schema": "https://json-schema.org/draft/2020-12/schema", 91 "properties": { 92 "foo": { 93 "not": {} 94 } 95 } 96 }, 97 "tests": [ 98 { 99 "description": "property present", 100 "data": { 101 "foo": 1, 102 "bar": 2 103 }, 104 "valid": false 105 }, 106 { 107 "description": "property absent", 108 "data": { 109 "bar": 1, 110 "baz": 2 111 }, 112 "valid": true 113 } 114 ] 115 }, 116 { 117 "description": "forbid everything with empty schema", 118 "schema": { 119 "$schema": "https://json-schema.org/draft/2020-12/schema", 120 "not": {} 121 }, 122 "tests": [ 123 { 124 "description": "number is invalid", 125 "data": 1, 126 "valid": false 127 }, 128 { 129 "description": "string is invalid", 130 "data": "foo", 131 "valid": false 132 }, 133 { 134 "description": "boolean true is invalid", 135 "data": true, 136 "valid": false 137 }, 138 { 139 "description": "boolean false is invalid", 140 "data": false, 141 "valid": false 142 }, 143 { 144 "description": "null is invalid", 145 "data": null, 146 "valid": false 147 }, 148 { 149 "description": "object is invalid", 150 "data": { 151 "foo": "bar" 152 }, 153 "valid": false 154 }, 155 { 156 "description": "empty object is invalid", 157 "data": {}, 158 "valid": false 159 }, 160 { 161 "description": "array is invalid", 162 "data": [ 163 "foo" 164 ], 165 "valid": false 166 }, 167 { 168 "description": "empty array is invalid", 169 "data": [], 170 "valid": false 171 } 172 ] 173 }, 174 { 175 "description": "forbid everything with boolean schema true", 176 "schema": { 177 "$schema": "https://json-schema.org/draft/2020-12/schema", 178 "not": true 179 }, 180 "tests": [ 181 { 182 "description": "number is invalid", 183 "data": 1, 184 "valid": false 185 }, 186 { 187 "description": "string is invalid", 188 "data": "foo", 189 "valid": false 190 }, 191 { 192 "description": "boolean true is invalid", 193 "data": true, 194 "valid": false 195 }, 196 { 197 "description": "boolean false is invalid", 198 "data": false, 199 "valid": false 200 }, 201 { 202 "description": "null is invalid", 203 "data": null, 204 "valid": false 205 }, 206 { 207 "description": "object is invalid", 208 "data": { 209 "foo": "bar" 210 }, 211 "valid": false 212 }, 213 { 214 "description": "empty object is invalid", 215 "data": {}, 216 "valid": false 217 }, 218 { 219 "description": "array is invalid", 220 "data": [ 221 "foo" 222 ], 223 "valid": false 224 }, 225 { 226 "description": "empty array is invalid", 227 "data": [], 228 "valid": false 229 } 230 ] 231 }, 232 { 233 "description": "allow everything with boolean schema false", 234 "schema": { 235 "$schema": "https://json-schema.org/draft/2020-12/schema", 236 "not": false 237 }, 238 "tests": [ 239 { 240 "description": "number is valid", 241 "data": 1, 242 "valid": true 243 }, 244 { 245 "description": "string is valid", 246 "data": "foo", 247 "valid": true 248 }, 249 { 250 "description": "boolean true is valid", 251 "data": true, 252 "valid": true 253 }, 254 { 255 "description": "boolean false is valid", 256 "data": false, 257 "valid": true 258 }, 259 { 260 "description": "null is valid", 261 "data": null, 262 "valid": true 263 }, 264 { 265 "description": "object is valid", 266 "data": { 267 "foo": "bar" 268 }, 269 "valid": true 270 }, 271 { 272 "description": "empty object is valid", 273 "data": {}, 274 "valid": true 275 }, 276 { 277 "description": "array is valid", 278 "data": [ 279 "foo" 280 ], 281 "valid": true, 282 "skip": { 283 "v2": "invalid value [\"foo\"] (does not satisfy matchN): 0 matched, expected 0:\n generated.cue:3:1\n generated.cue:1:1\n generated.cue:3:8\n instance.json:1:1\n" 284 } 285 }, 286 { 287 "description": "empty array is valid", 288 "data": [], 289 "valid": true, 290 "skip": { 291 "v2": "invalid value [] (does not satisfy matchN): 0 matched, expected 0:\n generated.cue:3:1\n generated.cue:1:1\n generated.cue:3:8\n instance.json:1:1\n" 292 } 293 } 294 ] 295 }, 296 { 297 "description": "double negation", 298 "schema": { 299 "$schema": "https://json-schema.org/draft/2020-12/schema", 300 "not": { 301 "not": {} 302 } 303 }, 304 "tests": [ 305 { 306 "description": "any value is valid", 307 "data": "foo", 308 "valid": true 309 } 310 ] 311 }, 312 { 313 "description": "collect annotations inside a 'not', even if collection is disabled", 314 "schema": { 315 "$schema": "https://json-schema.org/draft/2020-12/schema", 316 "not": { 317 "$comment": "this subschema must still produce annotations internally, even though the 'not' will ultimately discard them", 318 "anyOf": [ 319 true, 320 { 321 "properties": { 322 "foo": true 323 } 324 } 325 ], 326 "unevaluatedProperties": false 327 } 328 }, 329 "skip": { 330 "v2": "extract error: keyword \"unevaluatedProperties\" not yet implemented", 331 "v3": "extract error: keyword \"unevaluatedProperties\" not yet implemented" 332 }, 333 "tests": [ 334 { 335 "description": "unevaluated property", 336 "data": { 337 "bar": 1 338 }, 339 "valid": true, 340 "skip": { 341 "v2": "could not compile schema", 342 "v3": "could not compile schema" 343 } 344 }, 345 { 346 "description": "annotations are still collected inside a 'not'", 347 "data": { 348 "foo": 1 349 }, 350 "valid": false, 351 "skip": { 352 "v2": "could not compile schema", 353 "v3": "could not compile schema" 354 } 355 } 356 ] 357 } 358 ]