diff --git a/package-lock.json b/package-lock.json index 34d396c9..f21d2afc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "omniroute", - "version": "2.3.3", + "version": "2.3.12", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "omniroute", - "version": "2.3.3", + "version": "2.3.12", "hasInstallScript": true, "license": "MIT", "workspaces": [ diff --git a/src/shared/validation/schemas.ts b/src/shared/validation/schemas.ts index ae54f7f5..785989a2 100644 --- a/src/shared/validation/schemas.ts +++ b/src/shared/validation/schemas.ts @@ -785,10 +785,13 @@ export const updateProviderConnectionSchema = z export const providersBatchTestSchema = z .object({ mode: z.enum(["provider", "oauth", "free", "apikey", "compatible", "all"]), - providerId: z.string().trim().min(1).optional(), + // Frontend may send null when mode != 'provider' — accept and treat as missing + providerId: z.string().trim().min(1).nullable().optional(), }) .superRefine((value, ctx) => { - if (value.mode === "provider" && !value.providerId) { + // Treat null same as undefined + const pid = value.providerId ?? null; + if (value.mode === "provider" && !pid) { ctx.addIssue({ code: z.ZodIssueCode.custom, message: "providerId is required when mode=provider",