-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling of differences between Zod and Json Schema #73
Comments
Fair. Check #74 |
😍 Lovely! Didn't expect you to directly address this in code to be honest 🚀 |
Well, I agree with the problem description and it was a fairly quick fix. I'll see about getting it released in the coming days. |
Fix released in 3.21.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
When looking through the json schema specs on emails and how zod handles them I realised there's a fundamental difference: while the json schema spec uses RFC 5321 for
email
and RFC 6531 foridn-email
, zod uses a custom RegExp which it deems "reasonable".This is where I wondered if matching
zod.string().email()
to"format": "email"
actually makes sense, or if we should maybe use"pattern": "[regex from zod]"
instead. Otherwise one could run into issues where an email is valid for the json schema, but invalid when using zod.This issue extends to #40, where I'm currently adding RegExps for the aforementioned RFCs - which wouldn't be in line with how zod handles things and leads to enormous patterns being ejected.
I think this deserves a general answer, with options being
"format": "idn-email"
)"pattern": "[regex from zod]"
)@StefanTerdell
The text was updated successfully, but these errors were encountered: