-
-
Notifications
You must be signed in to change notification settings - Fork 98
Closed
Description
reproduction:
const schema = z.object({
title: z.string(),
value: z.coerce.number().min(1),
kind: z.nativeEnum({GRAY: "GRAY", GREEN: "GREEN"}),
description: z.string().optional()
});
export const load = (async (event) => {
const form = await superValidate(event, schema);
return {
form
};
}) satisfies PageServerLoad;if i set a .default("GRAY") to the enum field, it works ok
not sure if this is intentional, but one problem i noted with setting a default value is that it removes the required constraint.
tried submitting the form and got the following error: Error: Unsupported Zod default type: ZodNativeEnum
tried using z.enum and it works ok
Is there a plan on adding native enum support? the motivation for this support could be, for example, using the Enum Objects auto generated by prisma when defining an Enum Schema.
Metadata
Metadata
Assignees
Labels
No labels