adonisjs / rfcs

💬 Sharing big changes with community to add them to the AdonisJs eco-system
52 stars 6 forks source link

Support for stopping validation on first error per field #18

Closed olaoluwa-98 closed 3 years ago

olaoluwa-98 commented 5 years ago

For instance, if you have the following rules:

    email: 'required|email|unique:users,email',
    phone_no: 'required|unique:users,phone_no',
    password: 'required|min:8'

You may want the validation for email to stop on first error but continue to validate other fields such as phone_no and password which also will stop on first error of any rule item. I believe this feature will allow you to save time spent validating each item of a single rule.

validateAll continues to validate all fields including all the rules under each field. What I am proposing is a validate method that stops validation for each field on first error but continues to validate the other fields.

I am willing to work on it but will need assitance.

olaoluwa-98 commented 5 years ago

Opened this issue here already: https://github.com/poppinss/indicative/issues/250