support ad-hoc refing without entity types

This commit is contained in:
2026-03-20 15:53:48 -04:00
parent 75aac41362
commit 9f6c27c3b8
3 changed files with 189 additions and 39 deletions

View File

@ -719,6 +719,24 @@
{
"name": "attachment",
"schemas": [
{
"$id": "type_metadata",
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
{
"$id": "other_metadata",
"type": "object",
"properties": {
"other": {
"type": "string"
}
}
},
{
"$id": "attachment",
"$ref": "entity",
@ -729,9 +747,11 @@
"type": "string"
}
},
"metadata": {
"type": "object",
"additionalProperties": true
"type_metadata": {
"$ref": "type_metadata"
},
"other_metadata": {
"$ref": "other_metadata"
}
}
}
@ -744,7 +764,8 @@
"id",
"type",
"flags",
"metadata",
"type_metadata",
"other_metadata",
"created_at",
"created_by",
"modified_at",
@ -756,7 +777,8 @@
"id",
"type",
"flags",
"metadata"
"type_metadata",
"other_metadata"
],
"entity": [
"id",
@ -772,7 +794,8 @@
"id": "uuid",
"type": "text",
"flags": "_text",
"metadata": "jsonb",
"type_metadata": "jsonb",
"other_metadata": "jsonb",
"created_at": "timestamptz",
"created_by": "uuid",
"modified_at": "timestamptz",
@ -2260,7 +2283,7 @@
}
},
{
"description": "Insert attachment displaying side-by-side array literal and jsonb formatting translations",
"description": "Attachment with text[] and jsonb metadata structures",
"action": "merge",
"data": {
"type": "attachment",
@ -2268,9 +2291,11 @@
"urgent",
"reviewed"
],
"metadata": {
"size": 1024,
"source": "upload"
"other_metadata": {
"other": "hello"
},
"type_metadata": {
"type": "type_metadata"
}
},
"expect": {
@ -2298,14 +2323,16 @@
"INSERT INTO agreego.\"attachment\" (",
" \"flags\",",
" \"id\",",
" \"metadata\",",
" \"type\"",
" \"other_metadata\",",
" \"type\",",
" \"type_metadata\"",
")",
"VALUES (",
" '{\"urgent\",\"reviewed\"}',",
" '{{uuid:attachment_id}}',",
" '{\"size\":1024,\"source\":\"upload\"}',",
" 'attachment'",
" '{\"other\":\"hello\"}',",
" 'attachment',",
" '{\"type\":\"type_metadata\"}'",
")"
],
[
@ -2322,8 +2349,9 @@
" NULL,",
" '{",
" \"flags\":[\"urgent\",\"reviewed\"],",
" \"metadata\":{\"size\":1024,\"source\":\"upload\"},",
" \"type\":\"attachment\"",
" \"other_metadata\":{\"other\":\"hello\"},",
" \"type\":\"attachment\",",
" \"type_metadata\":{\"type\":\"type_metadata\"}",
" }',",
" '{{uuid:attachment_id}}',",
" '{{uuid}}',",
@ -2339,15 +2367,17 @@
" \"created_by\":\"00000000-0000-0000-0000-000000000000\",",
" \"flags\":[\"urgent\",\"reviewed\"],",
" \"id\":\"{{uuid:attachment_id}}\",",
" \"metadata\":{\"size\":1024,\"source\":\"upload\"},",
" \"modified_at\":\"{{timestamp}}\",",
" \"modified_by\":\"00000000-0000-0000-0000-000000000000\",",
" \"type\":\"attachment\"",
" \"other_metadata\":{\"other\":\"hello\"},",
" \"type\":\"attachment\",",
" \"type_metadata\":{\"type\":\"type_metadata\"}",
" },",
" \"new\":{",
" \"flags\":[\"urgent\",\"reviewed\"],",
" \"metadata\":{\"size\":1024,\"source\":\"upload\"},",
" \"type\":\"attachment\"",
" \"other_metadata\":{\"other\":\"hello\"},",
" \"type\":\"attachment\",",
" \"type_metadata\":{\"type\":\"type_metadata\"}",
" }",
" }')"
]