You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've regularly hoped for some kind of "metadata" in zod, but read a lot of discussion about why it's not needed.
In my case, I just need to be able to identify some of my own schemas.
I do this by comparing someSchema._def with mySchema._def, unwrapping optional et al.
Now I noticed that it does not work with descriptions. Digging into the zod code, I found this:
My feeling is that this means that the ._def will not point to my schema anymore.
What do you think about adding something like unwrap or innerType to describe, too?
Or am I doing something wrong?
The text was updated successfully, but these errors were encountered:
Hi, this pattern is very common in zod, the general def type name will be available, might not be what you need but that could be a pointer in the right direction.
Hey there 👋
I've regularly hoped for some kind of "metadata" in zod, but read a lot of discussion about why it's not needed.
In my case, I just need to be able to identify some of my own schemas.
I do this by comparing
someSchema._def
withmySchema._def
, unwrapping optional et al.Now I noticed that it does not work with descriptions. Digging into the zod code, I found this:
zod/src/types.ts
Lines 499 to 505 in 0862731
My feeling is that this means that the ._def will not point to my schema anymore.
What do you think about adding something like
unwrap
orinnerType
to describe, too?Or am I doing something wrong?
The text was updated successfully, but these errors were encountered: