-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat: directly pass zod objects to server and client #272
feat: directly pass zod objects to server and client #272
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@feder240516 is attempting to deploy a commit to the t3-oss Team on Vercel. A member of the Team first needs to authorize it. |
91935e2
to
6c47d37
Compare
6c47d37
to
0d51408
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way we can get the errors on the properties instead of the entire object?
FOO_BAR: z.string(), | ||
// @ts-expect-error - no FOO_ prefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm having the error on the key is a bit nicer ux
@@ -16,12 +16,12 @@ function ignoreErrors(cb: () => void) { | |||
test("server vars should not be prefixed", () => { | |||
ignoreErrors(() => { | |||
createEnv({ | |||
server: { | |||
// @ts-expect-error - server should not have NEXT_PUBLIC_ prefix | |||
// @ts-expect-error - server should not have NEXT_PUBLIC_ prefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
server: {}, | ||
client: { | ||
server: z.object({}), | ||
// @ts-expect-error - no NEXT_PUBLIC_ prefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way we can get the errors on the properties instead of the entire object?
@juliusmarminge it's something that I've explored, but I don't think it's possible, due to the properties being now part of the zod schema constructor |
hey we added standard schema support #299 so i think this will need to be restarted / abandoned. i'll close it given the amount of conflicts but the issue is still up |
fixes #169
Improvements:
ZodObject
s with transforms / refines / catchs are not supported. The same goes for other specialized types (z.union, z.discriminatedUnion, z.record).Discussion:
ZodObject
s are accepted