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
This feature request may be a bit far-fetched, feel free to close if out of scope, though I might give it a go if you're interested.
I have some fields which I'd like to annotate with a /// @zod.regex() constraint. The content of the regex is defined somewhere else in the app, and needs to find its way to the generated file.
Currently, I'm copying the regex to the schema file, which is brittle as it exists in two places (and god knows it's easy enough to make mistakes in one regex, trying to keep two in sync is a footgun).
One way to make constraint extensions via documentation use external code would be to use rich-comments again, to define imports in the model.
This feature request may be a bit far-fetched, feel free to close if out of scope, though I might give it a go if you're interested.
I have some fields which I'd like to annotate with a
/// @zod.regex()
constraint. The content of the regex is defined somewhere else in the app, and needs to find its way to the generated file.Currently, I'm copying the regex to the schema file, which is brittle as it exists in two places (and god knows it's easy enough to make mistakes in one regex, trying to keep two in sync is a footgun).
One way to make constraint extensions via documentation use external code would be to use rich-comments again, to define imports in the model.
Example API:
Generated code:
The text was updated successfully, but these errors were encountered: