[ { "description": "a schema given for prefixItems", "database": { "schemas": [ { "prefixItems": [ { "type": "integer" }, { "type": "string" } ], "$id": "prefixItems_0_0" } ] }, "tests": [ { "description": "correct types", "data": [ 1, "foo" ], "schema_id": "prefixItems_0_0", "action": "validate", "expect": { "success": true } }, { "description": "wrong types", "data": [ "foo", 1 ], "schema_id": "prefixItems_0_0", "action": "validate", "expect": { "success": false } }, { "description": "incomplete array of items", "data": [ 1 ], "schema_id": "prefixItems_0_0", "action": "validate", "expect": { "success": true } }, { "description": "array with additional items (invalid due to strictness)", "data": [ 1, "foo", true ], "schema_id": "prefixItems_0_0", "action": "validate", "expect": { "success": false } }, { "description": "empty array", "data": [], "schema_id": "prefixItems_0_0", "action": "validate", "expect": { "success": true } }, { "description": "JavaScript pseudo-array is valid (invalid due to strict object validation)", "data": { "0": "invalid", "1": "valid", "length": 2 }, "schema_id": "prefixItems_0_0", "action": "validate", "expect": { "success": false } } ] }, { "description": "prefixItems with boolean schemas", "database": { "schemas": [ { "prefixItems": [ true, false ], "$id": "prefixItems_1_0" } ] }, "tests": [ { "description": "array with one item is valid", "data": [ 1 ], "schema_id": "prefixItems_1_0", "action": "validate", "expect": { "success": true } }, { "description": "array with two items is invalid", "data": [ 1, "foo" ], "schema_id": "prefixItems_1_0", "action": "validate", "expect": { "success": false } }, { "description": "empty array is valid", "data": [], "schema_id": "prefixItems_1_0", "action": "validate", "expect": { "success": true } } ] }, { "description": "additional items are allowed by default", "database": { "schemas": [ { "prefixItems": [ { "type": "integer" } ], "extensible": true, "$id": "prefixItems_2_0" } ] }, "tests": [ { "description": "only the first item is validated", "data": [ 1, "foo", false ], "schema_id": "prefixItems_2_0", "action": "validate", "expect": { "success": true } } ] }, { "description": "prefixItems with null instance elements", "database": { "schemas": [ { "prefixItems": [ { "type": "null" } ], "$id": "prefixItems_3_0" } ] }, "tests": [ { "description": "allows null elements", "data": [ null ], "schema_id": "prefixItems_3_0", "action": "validate", "expect": { "success": true } } ] }, { "description": "extensible: true allows extra items with prefixItems", "database": { "schemas": [ { "prefixItems": [ { "type": "integer" } ], "extensible": true, "$id": "prefixItems_4_0" } ] }, "tests": [ { "description": "extra item is valid", "data": [ 1, "foo" ], "schema_id": "prefixItems_4_0", "action": "validate", "expect": { "success": true } } ] } ]