drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
21.44k stars 484 forks source link

[Feature Request]: drizzle-zod output to static files #2494

Open carafelix opened 2 weeks ago

carafelix commented 2 weeks ago

Describe what you want

Instead of generating the zod representation at runtime, I would like to be able to codegen it into a static file. Like:

export const insertPoemSchema = createInsertSchema(PoemTable, {output: './poemSchema.ts'});

or a CLI equivalent

// generated poemSchema.ts
export const insertPoemSchema = z.object({
  title: z.string(),
  text: z.string()
  // etc etc
})
MiraiSubject commented 1 week ago

Why is this issue closed? Does this feature exist already? If so where is it documented?

carafelix commented 1 week ago

Does this feature exist already? If so where is it documented?

As far as I'm aware, it does not exist.

Why is this issue closed?

After finding out that drizzle-zod was runtime agnostic, I didn't see much use case for it. I'll re-open it since it looks it might be useful for someone else.