added explicit lookup_fields to entity types

This commit is contained in:
2026-07-17 18:42:28 -04:00
parent e25890461d
commit ea5770aebe
9 changed files with 408 additions and 52 deletions

View File

@ -911,9 +911,7 @@
"archived"
]
},
"lookup_fields": [
"id"
],
"lookup_fields": [],
"historical": true,
"relationship": false,
"field_types": {
@ -1018,5 +1016,100 @@
}
}
]
},
{
"description": "Validation - lookup fields without matching index",
"database": {
"types": [
{
"id": "22222222-2222-2222-2222-222222222222",
"type": "type",
"name": "user",
"module": "test",
"source": "test",
"hierarchy": ["user"],
"variations": ["user"],
"fields": ["id", "email"],
"lookup_fields": ["email"],
"schemas": {
"user": {
"type": "object",
"properties": {
"id": { "type": "string", "format": "uuid" },
"email": { "type": "string", "format": "email" }
}
}
}
}
]
},
"tests": [
{
"description": "Fails setup compilation with MISSING_LOOKUP_INDEX if unique index is missing",
"action": "compile",
"expect": {
"success": false,
"errors": [
{
"code": "MISSING_LOOKUP_INDEX",
"values": {
"type": "user",
"lookup_fields": "[\"email\"]"
},
"details": {
"path": "/types/user",
"schema": "user"
}
}
]
}
}
]
},
{
"description": "Validation - lookup fields with matching index",
"database": {
"indexes": [
{
"table": "user",
"columns": ["email"]
}
],
"types": [
{
"id": "22222222-2222-2222-2222-222222222222",
"type": "type",
"name": "user",
"module": "test",
"source": "test",
"hierarchy": ["user"],
"variations": ["user"],
"fields": ["id", "email"],
"lookup_fields": ["email"],
"schemas": {
"user": {
"type": "object",
"properties": {
"id": { "type": "string", "format": "uuid" },
"email": { "type": "string", "format": "email" }
}
}
}
}
]
},
"tests": [
{
"description": "Compiles successfully when unique index matches lookup_fields",
"action": "compile",
"expect": {
"success": true,
"schemas": {
"user": {},
"user.filter": {}
}
}
}
]
}
]