[ { "description": "Invoice Attachment Reproducer", "database": { "puncs": [ { "name": "get_invoice", "schemas": { "get_invoice.response": { "oneOf": [ { "type": "invoice" }, { "type": "null" } ] } } } ], "enums": [], "relations": [ { "id": "10000000-0000-0000-0000-000000000001", "type": "relation", "constraint": "fk_attachment_attachable_entity", "source_type": "attachment", "source_columns": [ "attachable_id", "attachable_type" ], "destination_type": "entity", "destination_columns": [ "id", "type" ], "prefix": null } ], "types": [ { "name": "entity", "schemas": { "entity": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "type": { "type": "string" }, "archived": { "type": "boolean" }, "created_at": { "type": "string", "format": "date-time" } } } }, "hierarchy": [ "entity" ], "variations": [ "entity", "activity", "invoice", "attachment" ], "fields": [ "id", "type", "archived", "created_at" ], "grouped_fields": { "entity": [ "id", "type", "archived", "created_at" ] }, "field_types": { "id": "uuid", "type": "text", "archived": "boolean", "created_at": "timestamptz" }, "lookup_fields": [], "historical": false, "notify": false, "relationship": false }, { "name": "activity", "schemas": { "activity": { "type": "entity", "properties": { "start_date": { "type": "string", "format": "date-time" } } } }, "hierarchy": [ "activity", "entity" ], "variations": [ "activity", "invoice" ], "fields": [ "id", "type", "archived", "created_at", "start_date" ], "grouped_fields": { "entity": [ "id", "type", "archived", "created_at" ], "activity": [ "start_date" ] }, "field_types": { "id": "uuid", "type": "text", "archived": "boolean", "created_at": "timestamptz", "start_date": "timestamptz" }, "lookup_fields": [], "historical": false, "notify": false, "relationship": false }, { "name": "invoice", "schemas": { "invoice": { "type": "activity", "properties": { "status": { "type": "string" }, "attachments": { "type": "array", "items": { "type": "attachment" } } } } }, "hierarchy": [ "invoice", "activity", "entity" ], "variations": [ "invoice" ], "fields": [ "id", "type", "archived", "created_at", "start_date", "status" ], "grouped_fields": { "entity": [ "id", "type", "archived", "created_at" ], "activity": [ "start_date" ], "invoice": [ "status" ] }, "field_types": { "id": "uuid", "type": "text", "archived": "boolean", "created_at": "timestamptz", "start_date": "timestamptz", "status": "text" }, "lookup_fields": [], "historical": false, "notify": false, "relationship": false }, { "name": "attachment", "schemas": { "attachment": { "type": "entity", "properties": { "name": { "type": "string" }, "attachable_id": { "type": "string", "format": "uuid" }, "attachable_type": { "type": "string" }, "kind": { "type": "string" }, "file": { "type": "string" }, "data": { "type": "object" } } } }, "hierarchy": [ "attachment", "entity" ], "variations": [ "attachment" ], "fields": [ "id", "type", "archived", "created_at", "attachable_id", "attachable_type", "kind", "file", "data", "name" ], "grouped_fields": { "entity": [ "id", "type", "archived", "created_at" ], "attachment": [ "attachable_id", "attachable_type", "kind", "file", "data", "name" ] }, "field_types": { "id": "uuid", "type": "text", "archived": "boolean", "created_at": "timestamptz", "attachable_id": "uuid", "attachable_type": "text", "kind": "text", "file": "text", "data": "jsonb", "name": "text" }, "lookup_fields": [], "historical": false, "notify": false, "relationship": false } ] }, "tests": [ { "description": "Invoice with an empty array of attachments", "schema_id": "get_invoice.response", "data": { "id": "11111111-1111-1111-1111-111111111111", "type": "invoice", "archived": false, "created_at": "2023-01-01T00:00:00Z", "status": "draft", "attachments": [] }, "action": "validate", "expect": { "success": true } }, { "description": "Invoice with a valid attachment with null data", "schema_id": "get_invoice.response", "data": { "id": "11111111-1111-1111-1111-111111111111", "type": "invoice", "archived": false, "created_at": "2023-01-01T00:00:00Z", "status": "draft", "attachments": [ { "id": "22222222-2222-2222-2222-222222222222", "type": "attachment", "archived": false, "created_at": "2023-01-01T00:00:00Z", "name": "receipt", "attachable_id": "11111111-1111-1111-1111-111111111111", "attachable_type": "invoice", "kind": "document", "file": "path/to/doc.pdf" } ] }, "action": "validate", "expect": { "success": true } } ] } ]