chrishoermann / zod-prisma-types

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

Cannot use zod.array on JSON field #199

Closed adithep closed 8 months ago

adithep commented 8 months ago

Needs a certain structure for json:

/// @zod.custom.use(z.object({contents: z.array(z.object({locale: z.string(), content: z.string()}))}))
  content                  Json

error:

[@zod generator error]: '.array' validator is only allowed on lists. [Error Location]: Model: 'AA', Field: 'content'.

I think we should be able to use array in json fields.

chrishoermann commented 8 months ago

This should be fixed no in v3.0.0