chrishoermann / zod-prisma-types

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

`///zod.number.min()` alias for `///zod.number.gte()` missing #133

Closed andenacitelli closed 1 year ago

andenacitelli commented 1 year ago

I have this line in my Prisma schema:

currentUniversalCashbackPercentage Float                  @default(0) /// @zod.number.min(0).max(100)

I get this error on generating:

[@zod generator error]: Validator 'min' is not valid for type 'Float', for specified '@zod.[key] or for 'z.array.[key]'. [Error Location]: Model: 'Filters', Field: 'currentUniversalCashbackPercentage'.

Switching to gte() works fine. Relevant section of the zod docs: https://github.com/colinhacks/zod#numbers

chrishoermann commented 1 year ago

@andenacitelli is now implemented in latest version

andenacitelli commented 1 year ago

Nice, excellent work @chrishoermann!