chrishoermann / zod-prisma-types

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

Remove zodGenConfig.js in favor of shema.prisma config #109

Closed oceandrama closed 1 year ago

oceandrama commented 1 year ago

It would be a way more convinient to move skipGenerator setting to schema.prisma file instead of creating the new one. Unfortunately, I don't understand the point about strings value in the README. If you are using .env file, all values inside it also parsed as strings, so why can't we use something like this?

generator zod {
  provider = "zod-prisma-types"
  skip     = ENV("SKIP_ZOD_PRISMA")
}
chrishoermann commented 1 year ago

@oceandrama actually I never thougt about just parsing this kind of annotation and read out the env var in the generator. 😅 But yes, this would make handling this much easier.

The thing I meant by string values in the readme is that there is a separate type in the generator config that's called EnvValue and I thougt this type is meant to get values that are passed into the generator with the ENV("somthing") syntax already in a transformed state. But this did not work. So it seems I choose the wrong way here.

chrishoermann commented 1 year ago

@oceandrama I implemented even a simpler version of skipping the generator. Now only the presence of the SKIP_ZOD_PRISMA="true" environment variable is sufficient to skip generation.