chrishoermann / zod-prisma-types

Generator creates zod types for your prisma models with advanced validation
Other
579 stars 43 forks source link

how to use prisma comments to include .strict() in the output #152

Closed NazCodeland closed 8 months ago

NazCodeland commented 1 year ago

Hey, I looked through the examples but couldn't find/figure out how I can create a model type of .strict(), using prisma rich-comments, I tried doing

/// @zod.strict()
model User {
  id           Int           @id @default(autoincrement()) /// @zod.custom.omit([model, input]) 
  createdAt    DateTime      @default(now()) @db.Date /// @zod.custom.omit([model, input]) 
  lastLogIn    DateTime      @db.Timestamp() /// @zod.custom.omit([model, input]) 
  email        String        @unique
  login        String        @unique
  password     String
  profile      Profile?
  business     Business?
  appointments Appointment[]
  role         String /// @zod.custom.omit([model, input]) 
}

but that didn't work. Is there a way to have a model output of type script?

Thanks in advance.

chrishoermann commented 8 months ago

@NazCodeland this should now be ready to go in the latest version - see docs