From 9d853187269c5fa19bb2618aa6aab2676d2c889a Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Fri, 23 Oct 2026 15:20:14 -0700 Subject: [PATCH] fix(ui): keep dashboard schemas working on zod 4 zod 4.6 rejects a missing object key unless its schema is optional, even when the schema itself accepts undefined. The key edit form schema is built from z.custom fields that relied on the old behavior, so an empty or partially filled form failed to validate Build the schema from its shape with partial(), which makes every field optional the way main does with per-field optional(). The other zod importers type-check unchanged and their tests pass on zod 4.6.6 --- .../src/components/templates/keyEditFormValues.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/litellm-dashboard/src/components/templates/keyEditFormValues.ts b/ui/litellm-dashboard/src/components/templates/keyEditFormValues.ts index 7436380d6ee..f6a626c9fff 100644 --- a/ui/litellm-dashboard/src/components/templates/keyEditFormValues.ts +++ b/ui/litellm-dashboard/src/components/templates/keyEditFormValues.ts @@ -121,7 +121,7 @@ export const toKeyEditFormValues = (keyData: KeyResponse): KeyEditFormValues => rotation_interval: keyData.rotation_interval, }); -export const keyEditFormSchema = z.object({ +const keyEditFormShape = { key_alias: z.custom(), models: z.custom(), allowed_routes: z.custom(), @@ -166,7 +166,9 @@ export const keyEditFormSchema = z.object({ disabled_callbacks: z.custom(), auto_rotate: z.custom(), rotation_interval: z.custom(), -}); +}; + +export const keyEditFormSchema = z.object(keyEditFormShape).partial(); export interface MountedFieldGates { canViewPolicies: boolean;