Semicolon separated emails using drizzle-zod.

I have the following Schema definition for drizzle-zod:
export const RegistroSchema = createSelectSchema(registro, {
    correo: (schema) => schema.correo.email(),
    retencionRenta: (schema) => schema.retencionRenta.optional(),
    retencionIVA: (schema) => schema.retencionIVA.optional()
});


I want to change the email verification from a single to a multi email verification
I have an idea of the required zod definition
z.object({
  factoryEmail: z
    .string()
    .refine((emailValue) => emailValue.split(";").every((item) => z.string().email().safeParse(item).success)),
});

but I am not sure how to represent that inside ResitroShema (for the field: correo)?
Was this page helpful?