fix: add utf8 email validation support (#6239)

Co-authored-by: Thomas <thomas@ajnart.fr>
This commit is contained in:
Nam NguyenandThomas authored and GitHub committed 2026-07-10 17:28:22 +02:00
1 parent 7c152cf4fe
commit 7d93df04dd
6 files changed
+43 -13

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
import { z } from "zod/v4";
export const utf8EmailSchema = z.email({ pattern: z.regexes.unicodeEmail });
export const optionalEmailSchema = utf8EmailSchema.or(z.string().length(0)).optional();
export const nullableEmailSchema = utf8EmailSchema
.or(z.literal(""))
.transform((value) => (value === "" ? null : value))
.optional()
.nullable();
export const requiredNullableEmailSchema = utf8EmailSchema
.or(z.literal(""))
.transform((value) => (value === "" ? null : value))
.nullable();