Skip to content

Commit 381e423

Browse files
authored
insight playground - allow array items to be single item (#7373)
1 parent c70d5ab commit 381e423

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,9 +815,13 @@ function openAPIV3ParamToZodFormSchema(
815815
}
816816

817817
if (itemSchema) {
818-
return isRequired
818+
const arraySchema = isRequired
819819
? z.array(itemSchema).min(1, { message: "Required" })
820-
: z.array(itemSchema).optional();
820+
: z.array(itemSchema);
821+
const arrayOrSingleItemSchema = z.union([arraySchema, itemSchema]);
822+
return isRequired
823+
? arrayOrSingleItemSchema
824+
: arrayOrSingleItemSchema.optional();
821825
}
822826
}
823827
break;

0 commit comments

Comments
 (0)