adonisjs / validator

Schema based validator for AdonisJS
MIT License
116 stars 39 forks source link

Create `min` and `max` validators for number type #169

Open Bobakanoosh opened 1 year ago

Bobakanoosh commented 1 year ago

Why this feature is required (specific use-cases will be appreciated)?

For example, if I have a purchase, and want to enforce the purchase's amount to be greater than 0.

Have you tried any other work arounds?

I made my own custom rule, but figure it would be nice to have in the actual framework.

Are you willing to work on it with little guidance?

Yes

RomainLanz commented 1 year ago

Hey @Bobakanoosh! 👋🏻

I would happily accept a PR to add that!

matheussss1 commented 10 months ago

@Bobakanoosh actually you can use something like:

schema.number([rules.range(0, Infinity)]) #