[ { "description": "basic validation integrity", "enums": [], "types": [], "puncs": [ { "name": "simple", "public": false, "schemas": [ { "$id": "simple.request", "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "integer", "minimum": 0 } }, "required": [ "name", "age" ] } ] }, { "name": "object_test", "public": false, "schemas": [ { "$id": "object_test.request", "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "integer", "minimum": 0 } }, "required": [ "name", "age" ] } ] }, { "name": "array_test", "public": false, "schemas": [ { "$id": "array_test.request", "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" } } } } ] } ], "tests": [ { "description": "valid instance", "schema_id": "simple.request", "data": { "name": "Alice", "age": 30 }, "valid": true }, { "description": "invalid type - negative age", "schema_id": "simple.request", "data": { "name": "Bob", "age": -5 }, "valid": false, "expect_errors": [ { "code": "MINIMUM_VIOLATED", "path": "/age", "context": -5, "cause": { "got": -5.0, "want": 0.0 } } ] }, { "description": "missing required field", "schema_id": "simple.request", "data": { "name": "Charlie" }, "valid": false, "expect_errors": [ { "code": "REQUIRED_FIELD_MISSING", "path": "/age", "cause": { "want": [ "age" ] } } ] }, { "description": "valid object root type", "schema_id": "object_test.request", "data": { "name": "test", "age": 25 }, "valid": true }, { "description": "valid array root type", "schema_id": "array_test.request", "data": [ { "id": "550e8400-e29b-41d4-a716-446655440000" } ], "valid": true }, { "description": "valid empty array", "schema_id": "array_test.request", "data": [], "valid": true }, { "description": "null against array schema", "schema_id": "array_test.request", "data": null, "valid": false, "expect_errors": [ { "code": "TYPE_MISMATCH", "path": "", "context": null, "cause": { "got": "null", "want": "array" } } ] }, { "description": "object against array schema", "schema_id": "array_test.request", "data": { "id": "not-an-array" }, "valid": false, "expect_errors": [ { "code": "TYPE_MISMATCH", "path": "", "context": { "id": "not-an-array" }, "cause": { "got": "object", "want": "array" } } ] }, { "description": "string against object schema", "schema_id": "object_test.request", "data": "not an object", "valid": false, "expect_errors": [ { "code": "TYPE_MISMATCH", "path": "", "context": "not an object", "cause": { "got": "string", "want": "object" } } ] } ] } ]