1[ 2 { 3 "description": "a schema given for prefixItems", 4 "schema": { 5 "$schema": "https://json-schema.org/draft/2020-12/schema", 6 "prefixItems": [ 7 {"type": "integer"}, 8 {"type": "string"} 9 ] 10 }, 11 "tests": [ 12 { 13 "description": "correct types", 14 "data": [ 1, "foo" ], 15 "valid": true 16 }, 17 { 18 "description": "wrong types", 19 "data": [ "foo", 1 ], 20 "valid": false 21 }, 22 { 23 "description": "incomplete array of items", 24 "data": [ 1 ], 25 "valid": true 26 }, 27 { 28 "description": "array with additional items", 29 "data": [ 1, "foo", true ], 30 "valid": true 31 }, 32 { 33 "description": "empty array", 34 "data": [ ], 35 "valid": true 36 }, 37 { 38 "description": "JavaScript pseudo-array is valid", 39 "data": { 40 "0": "invalid", 41 "1": "valid", 42 "length": 2 43 }, 44 "valid": true 45 } 46 ] 47 }, 48 { 49 "description": "prefixItems with boolean schemas", 50 "schema": { 51 "$schema": "https://json-schema.org/draft/2020-12/schema", 52 "prefixItems": [true, false] 53 }, 54 "tests": [ 55 { 56 "description": "array with one item is valid", 57 "data": [ 1 ], 58 "valid": true 59 }, 60 { 61 "description": "array with two items is invalid", 62 "data": [ 1, "foo" ], 63 "valid": false 64 }, 65 { 66 "description": "empty array is valid", 67 "data": [], 68 "valid": true 69 } 70 ] 71 }, 72 { 73 "description": "additional items are allowed by default", 74 "schema": { 75 "$schema": "https://json-schema.org/draft/2020-12/schema", 76 "prefixItems": [{"type": "integer"}] 77 }, 78 "tests": [ 79 { 80 "description": "only the first item is validated", 81 "data": [1, "foo", false], 82 "valid": true 83 } 84 ] 85 }, 86 { 87 "description": "prefixItems with null instance elements", 88 "schema": { 89 "$schema": "https://json-schema.org/draft/2020-12/schema", 90 "prefixItems": [ 91 { 92 "type": "null" 93 } 94 ] 95 }, 96 "tests": [ 97 { 98 "description": "allows null elements", 99 "data": [ null ], 100 "valid": true 101 } 102 ] 103 } 104] 105