omar-dulaimi / prisma-zod-generator

Prisma 2+ generator to emit Zod schemas from your Prisma schema
MIT License
513 stars 45 forks source link

Fix data args for createMany #60

Closed feelixe closed 1 year ago

feelixe commented 1 year ago

Description

Add z.array() on data property in createMany<model>.schema.ts. This makes the zod schema conform to the prisma usage docs which requires a Enumerable around the input for createMany:

export type UserCreateManyArgs = {
  data: Enumerable<UserCreateManyInput>
  skipDuplicates?: boolean
}

References

closes #50

omar-dulaimi commented 1 year ago

Hey @Feelixe-tin Actually the Enumerable type is defined like this: export type Enumerable<T> = T | Array<T>; So you need to match it

omar-dulaimi commented 1 year ago

@Feelixe-tin Any update on this?

omar-dulaimi commented 1 year ago

Released in https://github.com/omar-dulaimi/prisma-zod-generator/releases/tag/0.8.7