chrishoermann / zod-prisma-types

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

decimal validation #112

Open michiim opened 1 year ago

michiim commented 1 year ago

Would be great to have an easy solution for validation decimal "numbers" without using custom functions. Just like the way numbers are validated

ex. /// @zod.decimal.lt(10).gt(1)

chrishoermann commented 1 year ago

@michiim Thanks for the request. This is generally a good Idea but currently I do not plan to implement validators that are not natively supported by zod since this would require some major refactors in how the validators are handled and validated during generation.

I have not worked with decimals that much but I'd believe you, when you say that they can be a bit of a pain to work with when some advanced validation is needed. But for now please use this approach.