Add Zod generation #18989
Replies: 2 comments
|
I had a similar thought. It would be nice to have zod schemas based on the checks already made to columns of the tables. On the other hand, even if generation of the schemas worked, then the schemas would need to be customized with messages and whatever other customizations each application might require. It would be painful for the schema generation to work most of the time and then there needs to be something custom for one schema and there's no access to the raw generated schema. If you care that your zod schemas match your database checks, I would think it is probably best to design tests to ensure data validated by your zod schema passes the checks created in the database. It's more work, but it might be quicker in the end and end up with less bugs. Just my 2 cents. |
|
To whoever may be looking at this old thread - there's a library for this https://github.com/dohooo/supazod, but it has some zod4 problems right now it seems, which soon should be fixed dohooo/supazod#8 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
All reactions