fix: add utf8 email validation support (#6239)
Co-authored-by: Thomas <thomas@ajnart.fr>
This commit is contained in:
1 parent
7c152cf4fe
commit
7d93df04dd
6 files changed
+43
-13
No files matched your search
@@ -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();
|
||||
Reference in new issue
Block a user