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
Make Slonik runtime validation non-Zod specific #514
Comments
This is roughly what I was going for in #371 |
Blocked some time this evening to refresh memory. Sorry that it got pushed aside; at the time I was overwhelmed with feedback. |
Wouldn't a middleware approach be better? It seems odd that you have to install the |
FWIW, there's plenty of us out there who love Slonik, but would also love to be able to use something else than Zod. Not that there's anything wrong with Zod itself, but we have a non-trivial amount of code already using |
@gajus Is there any intention to see this through? My team is finding the Zod requirement to be very clunky with v37 since we already heavily rely on |
Realistically, not within any reasonable timeframe. It is something I would want to support, but it is big lift to do it properly, and I have no commercial reason to undertake it. |
Desired Behavior
I should be able to initiate
sql
tag andpool
with types that override the base Zod types.I initially thought this would be a huge lift, but after doing some refactoring realized that we really need to override just two types:
ZodTypeAny
andz.infer
.Therefore, Slonik could be made non-Zod specific with an API similar to:
(This is just a rough idea, not a suggestion for the API.)
Then the consumer of Slonik would create a file in their project that sets up Slonik and consume exports from that file throughout their project, rather than directly importing from Slonik (that's already the recommended pattern anyway).
Motivation
Not everyone uses Zod.
Implementation
N/A
The text was updated successfully, but these errors were encountered: