feat: Make providerId nullable in providersBatchTestSchema and update validation to treat null as an absent value.

This commit is contained in:
diegosouzapw
2026-03-12 17:08:26 -03:00
parent 8dad2d32b6
commit 7da23a90d4
2 changed files with 7 additions and 4 deletions
+2 -2
View File
@@ -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": [
+5 -2
View File
@@ -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",