fix: wrap nullable event fields with optional() for missing keys

anyvali nullable() accepts null but rejects undefined (absent field).
Kiosk log events omit camera_id/property_op entirely. Wrap with
optional() so missing fields default to null.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mitchell R 2026-05-26 15:26:55 +02:00
parent 9eeddff680
commit db0f6fdd53
No known key found for this signature in database

View file

@ -77,8 +77,8 @@ export const EventBody = av.object(
{ {
topic: av.string().minLength(1).maxLength(512), topic: av.string().minLength(1).maxLength(512),
source_type: av.string().maxLength(32).default("system"), source_type: av.string().maxLength(32).default("system"),
camera_id: av.nullable(av.string().maxLength(64)).default(null), camera_id: av.optional(av.nullable(av.string().maxLength(64))).default(null),
property_op: av.nullable(av.string().maxLength(32)).default(null), property_op: av.optional(av.nullable(av.string().maxLength(32))).default(null),
payload: av.any().default({}), payload: av.any().default({}),
}, },
{ unknownKeys: "strip" }, { unknownKeys: "strip" },