[ { "description": "allOf", "database": { "schemas": [ { "allOf": [ { "properties": { "bar": { "type": "integer" } }, "required": [ "bar" ] }, { "properties": { "foo": { "type": "string" } }, "required": [ "foo" ] } ], "$id": "allOf_0_0" } ] }, "tests": [ { "description": "allOf", "data": { "foo": "baz", "bar": 2 }, "valid": true, "schema_id": "allOf_0_0" }, { "description": "mismatch second", "data": { "foo": "baz" }, "valid": false, "schema_id": "allOf_0_0" }, { "description": "mismatch first", "data": { "bar": 2 }, "valid": false, "schema_id": "allOf_0_0" }, { "description": "wrong type", "data": { "foo": "baz", "bar": "quux" }, "valid": false, "schema_id": "allOf_0_0" } ] }, { "description": "allOf with base schema", "database": { "schemas": [ { "properties": { "bar": { "type": "integer" }, "baz": {}, "foo": { "type": "string" } }, "required": [ "bar" ], "allOf": [ { "properties": { "foo": { "type": "string" } }, "required": [ "foo" ] }, { "properties": { "baz": { "type": "null" } }, "required": [ "baz" ] } ], "$id": "allOf_1_0" } ] }, "tests": [ { "description": "valid", "data": { "foo": "quux", "bar": 2, "baz": null }, "valid": true, "schema_id": "allOf_1_0" }, { "description": "mismatch base schema", "data": { "foo": "quux", "baz": null }, "valid": false, "schema_id": "allOf_1_0" }, { "description": "mismatch first allOf", "data": { "bar": 2, "baz": null }, "valid": false, "schema_id": "allOf_1_0" }, { "description": "mismatch second allOf", "data": { "foo": "quux", "bar": 2 }, "valid": false, "schema_id": "allOf_1_0" }, { "description": "mismatch both", "data": { "bar": 2 }, "valid": false, "schema_id": "allOf_1_0" } ] }, { "description": "allOf simple types", "database": { "schemas": [ { "allOf": [ { "maximum": 30 }, { "minimum": 20 } ], "$id": "allOf_2_0" } ] }, "tests": [ { "description": "valid", "data": 25, "valid": true, "schema_id": "allOf_2_0" }, { "description": "mismatch one", "data": 35, "valid": false, "schema_id": "allOf_2_0" } ] }, { "description": "allOf with boolean schemas, all true", "database": { "schemas": [ { "allOf": [ true, true ], "$id": "allOf_3_0" } ] }, "tests": [ { "description": "any value is valid", "data": "foo", "valid": true, "schema_id": "allOf_3_0" } ] }, { "description": "allOf with boolean schemas, some false", "database": { "schemas": [ { "allOf": [ true, false ], "$id": "allOf_4_0" } ] }, "tests": [ { "description": "any value is invalid", "data": "foo", "valid": false, "schema_id": "allOf_4_0" } ] }, { "description": "allOf with boolean schemas, all false", "database": { "schemas": [ { "allOf": [ false, false ], "$id": "allOf_5_0" } ] }, "tests": [ { "description": "any value is invalid", "data": "foo", "valid": false, "schema_id": "allOf_5_0" } ] }, { "description": "allOf with one empty schema", "database": { "schemas": [ { "allOf": [ {} ], "$id": "allOf_6_0" } ] }, "tests": [ { "description": "any data is valid", "data": 1, "valid": true, "schema_id": "allOf_6_0" } ] }, { "description": "allOf with two empty schemas", "database": { "schemas": [ { "allOf": [ {}, {} ], "$id": "allOf_7_0" } ] }, "tests": [ { "description": "any data is valid", "data": 1, "valid": true, "schema_id": "allOf_7_0" } ] }, { "description": "allOf with the first empty schema", "database": { "schemas": [ { "allOf": [ {}, { "type": "number" } ], "$id": "allOf_8_0" } ] }, "tests": [ { "description": "number is valid", "data": 1, "valid": true, "schema_id": "allOf_8_0" }, { "description": "string is invalid", "data": "foo", "valid": false, "schema_id": "allOf_8_0" } ] }, { "description": "allOf with the last empty schema", "database": { "schemas": [ { "allOf": [ { "type": "number" }, {} ], "$id": "allOf_9_0" } ] }, "tests": [ { "description": "number is valid", "data": 1, "valid": true, "schema_id": "allOf_9_0" }, { "description": "string is invalid", "data": "foo", "valid": false, "schema_id": "allOf_9_0" } ] }, { "description": "nested allOf, to check validation semantics", "database": { "schemas": [ { "allOf": [ { "allOf": [ { "type": "null" } ] } ], "$id": "allOf_10_0" } ] }, "tests": [ { "description": "null is valid", "data": null, "valid": true, "schema_id": "allOf_10_0" }, { "description": "anything non-null is invalid", "data": 123, "valid": false, "schema_id": "allOf_10_0" } ] }, { "description": "extensible: true allows extra properties in allOf", "database": { "schemas": [ { "allOf": [ { "properties": { "bar": { "type": "integer" } }, "required": [ "bar" ] }, { "properties": { "foo": { "type": "string" } }, "required": [ "foo" ] } ], "extensible": true, "$id": "allOf_12_0" } ] }, "tests": [ { "description": "extra property is valid", "data": { "foo": "baz", "bar": 2, "qux": 3 }, "valid": true, "schema_id": "allOf_12_0" } ] }, { "description": "strict by default with allOf properties", "database": { "schemas": [ { "allOf": [ { "properties": { "foo": { "const": 1 } } }, { "properties": { "bar": { "const": 2 } } } ], "$id": "allOf_13_0" } ] }, "tests": [ { "description": "validates merged properties", "data": { "foo": 1, "bar": 2 }, "valid": true, "schema_id": "allOf_13_0" }, { "description": "fails on extra property z explicitly", "data": { "foo": 1, "bar": 2, "z": 3 }, "valid": false, "schema_id": "allOf_13_0" } ] }, { "description": "allOf with nested extensible: true (partial looseness)", "database": { "schemas": [ { "allOf": [ { "properties": { "foo": { "const": 1 } } }, { "extensible": true, "properties": { "bar": { "const": 2 } } } ], "$id": "allOf_14_0" } ] }, "tests": [ { "description": "extensible subschema doesn't make root extensible if root is strict", "data": { "foo": 1, "bar": 2, "z": 3 }, "valid": true, "schema_id": "allOf_14_0" } ] }, { "description": "strictness: allOf composition with strict refs", "database": { "schemas": [ { "allOf": [ { "$ref": "partA" }, { "$ref": "partB" } ], "$id": "allOf_15_0" }, { "$id": "partA", "properties": { "id": { "type": "string" } } }, { "$id": "partB", "properties": { "name": { "type": "string" } } } ] }, "tests": [ { "description": "merged instance is valid", "data": { "id": "1", "name": "Me" }, "valid": true, "schema_id": "allOf_15_0" }, { "description": "extra property is invalid (root is strict)", "data": { "id": "1", "name": "Me", "extra": 1 }, "valid": false, "schema_id": "allOf_15_0" }, { "description": "partA mismatch is invalid", "data": { "id": 1, "name": "Me" }, "valid": false, "schema_id": "allOf_15_0" } ] } ]