[ { "description": "a schema given for items", "database": { "schemas": [ { "items": { "type": "integer" }, "$id": "items_0_0" } ] }, "tests": [ { "description": "valid items", "data": [ 1, 2, 3 ], "valid": true, "schema_id": "items_0_0" }, { "description": "wrong type of items", "data": [ 1, "x" ], "valid": false, "schema_id": "items_0_0" }, { "description": "non-arrays are invalid", "data": { "foo": "bar" }, "valid": false, "schema_id": "items_0_0" }, { "description": "JavaScript pseudo-arrays are invalid", "data": { "0": "invalid", "length": 1 }, "valid": false, "schema_id": "items_0_0" } ] }, { "description": "items with boolean schema (true)", "database": { "schemas": [ { "items": true, "$id": "items_1_0" } ] }, "tests": [ { "description": "any array is valid", "data": [ 1, "foo", true ], "valid": true, "schema_id": "items_1_0" }, { "description": "empty array is valid", "data": [], "valid": true, "schema_id": "items_1_0" } ] }, { "description": "items with boolean schema (false)", "database": { "schemas": [ { "items": false, "$id": "items_2_0" } ] }, "tests": [ { "description": "any non-empty array is invalid", "data": [ 1, "foo", true ], "valid": false, "schema_id": "items_2_0" }, { "description": "empty array is valid", "data": [], "valid": true, "schema_id": "items_2_0" } ] }, { "description": "items and subitems", "database": { "schemas": [ { "type": "array", "items": false, "prefixItems": [ { "$ref": "item" }, { "$ref": "item" }, { "$ref": "item" } ], "$id": "items_3_0" }, { "$id": "item", "type": "array", "items": false, "prefixItems": [ { "$ref": "sub-item" }, { "$ref": "sub-item" } ] }, { "$id": "sub-item", "type": "object", "required": [ "foo" ] } ] }, "tests": [ { "description": "valid items", "data": [ [ { "foo": null }, { "foo": null } ], [ { "foo": null }, { "foo": null } ], [ { "foo": null }, { "foo": null } ] ], "valid": false, "schema_id": "items_3_0" }, { "description": "too many items", "data": [ [ { "foo": null }, { "foo": null } ], [ { "foo": null }, { "foo": null } ], [ { "foo": null }, { "foo": null } ], [ { "foo": null }, { "foo": null } ] ], "valid": false, "schema_id": "items_3_0" }, { "description": "too many sub-items", "data": [ [ { "foo": null }, { "foo": null }, { "foo": null } ], [ { "foo": null }, { "foo": null } ], [ { "foo": null }, { "foo": null } ] ], "valid": false, "schema_id": "items_3_0" }, { "description": "wrong item", "data": [ { "foo": null }, [ { "foo": null }, { "foo": null } ], [ { "foo": null }, { "foo": null } ] ], "valid": false, "schema_id": "items_3_0" }, { "description": "wrong sub-item", "data": [ [ {}, { "foo": null } ], [ { "foo": null }, { "foo": null } ], [ { "foo": null }, { "foo": null } ] ], "valid": false, "schema_id": "items_3_0" }, { "description": "fewer items is invalid", "data": [ [ { "foo": null } ], [ { "foo": null } ] ], "valid": false, "schema_id": "items_3_0" } ] }, { "description": "nested items", "database": { "schemas": [ { "type": "array", "items": { "type": "array", "items": { "type": "array", "items": { "type": "array", "items": { "type": "number" } } } }, "$id": "items_4_0" } ] }, "tests": [ { "description": "valid nested array", "data": [ [ [ [ 1 ] ], [ [ 2 ], [ 3 ] ] ], [ [ [ 4 ], [ 5 ], [ 6 ] ] ] ], "valid": true, "schema_id": "items_4_0" }, { "description": "nested array with invalid type", "data": [ [ [ [ "1" ] ], [ [ 2 ], [ 3 ] ] ], [ [ [ 4 ], [ 5 ], [ 6 ] ] ] ], "valid": false, "schema_id": "items_4_0" }, { "description": "not deep enough", "data": [ [ [ 1 ], [ 2 ], [ 3 ] ], [ [ 4 ], [ 5 ], [ 6 ] ] ], "valid": false, "schema_id": "items_4_0" } ] }, { "description": "prefixItems with no additional items allowed", "database": { "schemas": [ { "prefixItems": [ {}, {}, {} ], "items": false, "$id": "items_5_0" } ] }, "tests": [ { "description": "empty array", "data": [], "valid": true, "schema_id": "items_5_0" }, { "description": "fewer number of items present (1)", "data": [ 1 ], "valid": true, "schema_id": "items_5_0" }, { "description": "fewer number of items present (2)", "data": [ 1, 2 ], "valid": true, "schema_id": "items_5_0" }, { "description": "equal number of items present", "data": [ 1, 2, 3 ], "valid": true, "schema_id": "items_5_0" }, { "description": "additional items are not permitted", "data": [ 1, 2, 3, 4 ], "valid": false, "schema_id": "items_5_0" } ] }, { "description": "items does not look in applicators, valid case", "database": { "schemas": [ { "allOf": [ { "prefixItems": [ { "minimum": 3 } ] } ], "items": { "minimum": 5 }, "$id": "items_6_0" } ] }, "tests": [ { "description": "prefixItems in allOf does not constrain items, invalid case", "data": [ 3, 5 ], "valid": false, "schema_id": "items_6_0" }, { "description": "prefixItems in allOf does not constrain items, valid case", "data": [ 5, 5 ], "valid": true, "schema_id": "items_6_0" } ] }, { "description": "prefixItems validation adjusts the starting index for items", "database": { "schemas": [ { "prefixItems": [ { "type": "string" } ], "items": { "type": "integer" }, "$id": "items_7_0" } ] }, "tests": [ { "description": "valid items", "data": [ "x", 2, 3 ], "valid": true, "schema_id": "items_7_0" }, { "description": "wrong type of second item", "data": [ "x", "y" ], "valid": false, "schema_id": "items_7_0" } ] }, { "description": "items with heterogeneous array", "database": { "schemas": [ { "prefixItems": [ {} ], "items": false, "$id": "items_8_0" } ] }, "tests": [ { "description": "heterogeneous invalid instance", "data": [ "foo", "bar", 37 ], "valid": false, "schema_id": "items_8_0" }, { "description": "valid instance", "data": [ null ], "valid": true, "schema_id": "items_8_0" } ] }, { "description": "items with null instance elements", "database": { "schemas": [ { "items": { "type": "null" }, "$id": "items_9_0" } ] }, "tests": [ { "description": "allows null elements", "data": [ null ], "valid": true, "schema_id": "items_9_0" } ] }, { "description": "extensible: true allows extra items (when items is false)", "database": { "schemas": [ { "items": false, "extensible": true, "$id": "items_10_0" } ] }, "tests": [ { "description": "extra item is valid", "data": [ 1 ], "valid": false, "schema_id": "items_10_0" } ] }, { "description": "extensible: true allows extra properties for items", "database": { "schemas": [ { "items": { "minimum": 5 }, "extensible": true, "$id": "items_11_0" } ] }, "tests": [ { "description": "valid item is valid", "data": [ 5, 6 ], "valid": true, "schema_id": "items_11_0" }, { "description": "invalid item (less than min) is invalid even with extensible: true", "data": [ 4 ], "valid": false, "schema_id": "items_11_0" } ] }, { "description": "array: simple extensible array", "database": { "schemas": [ { "type": "array", "extensible": true, "$id": "items_12_0" } ] }, "tests": [ { "description": "empty array is valid", "data": [], "valid": true, "schema_id": "items_12_0" }, { "description": "array with items is valid (extensible)", "data": [ 1, "foo" ], "valid": true, "schema_id": "items_12_0" } ] }, { "description": "array: strict array", "database": { "schemas": [ { "type": "array", "extensible": false, "$id": "items_13_0" } ] }, "tests": [ { "description": "empty array is valid", "data": [], "valid": true, "schema_id": "items_13_0" }, { "description": "array with items is invalid (strict)", "data": [ 1 ], "valid": false, "schema_id": "items_13_0" } ] }, { "description": "array: items extensible", "database": { "schemas": [ { "type": "array", "items": { "extensible": true }, "$id": "items_14_0" } ] }, "tests": [ { "description": "empty array is valid", "data": [], "valid": true, "schema_id": "items_14_0" }, { "description": "array with items is valid (items explicitly allowed to be anything extensible)", "data": [ 1, "foo", {} ], "valid": true, "schema_id": "items_14_0" } ] }, { "description": "array: items strict", "database": { "schemas": [ { "type": "array", "items": { "type": "object", "extensible": false }, "$id": "items_15_0" } ] }, "tests": [ { "description": "empty array is valid (empty objects)", "data": [ {} ], "valid": true, "schema_id": "items_15_0" }, { "description": "array with strict object items is valid", "data": [ {} ], "valid": true, "schema_id": "items_15_0" }, { "description": "array with invalid strict object items (extra property)", "data": [ { "extra": 1 } ], "valid": false, "schema_id": "items_15_0" } ] } ]