Skip to content

[FEATURE]: Codegen for zod schemas #941

@michaelschufi

Description

@michaelschufi

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions