mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-31 06:56:59 +00:00
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
This commit is contained in:
parent
c5901cef5b
commit
9d85318726
1 changed files with 4 additions and 2 deletions
|
|
@ -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<string | undefined>(),
|
||||
models: z.custom<string[] | undefined>(),
|
||||
allowed_routes: z.custom<string | undefined>(),
|
||||
|
|
@ -166,7 +166,9 @@ export const keyEditFormSchema = z.object({
|
|||
disabled_callbacks: z.custom<string[] | undefined>(),
|
||||
auto_rotate: z.custom<boolean | undefined>(),
|
||||
rotation_interval: z.custom<string | undefined>(),
|
||||
});
|
||||
};
|
||||
|
||||
export const keyEditFormSchema = z.object(keyEditFormShape).partial();
|
||||
|
||||
export interface MountedFieldGates {
|
||||
canViewPolicies: boolean;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue