drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: Codegen for zod schemas
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Describe what you want
I love the idea of `createInsertSchema` and `createSelectSchema`.
However, extending the Zod schemas generated by those functions and importing them in a client component, results in `drizzle-zod` and `drizzle-orm` being in the client bundle. That's more than 20 KB gzipped, afaik. Also, TypeScript has a hard time inferring the whole tree back to the table definitions.
Because of that, I propose a codegen feature for `drizzle-zod`, which would generate `z.object(...)` code (what e.g. `createInsertSchema` would produce) in a different file. This way, it can be easily imported in the client and the performance should improve as well.
What do you think?
Contributor guide
Assessment
This issue has not been assessed yet.