Closed DZ8540 closed 2 years ago
Going to be a breaking change and cannot be shipped until AdonisJS 6.0
This commit makes the first argument to accept both the options
or an array of rules
.
After the next release, you can simplify your code as follows.
schema.string([
rules.unique(),
rules.minLength()
])
Why this feature is required (specific use-cases will be appreciated)?
Most AdonisJS users happen to even add trim option when create string schema validator, if passing rules to this string validator. It is not comfortable!
example:
It would be great if the options were after the rules, then all users wouldn't have to passing trim option for string validator every time.
As a suggestion, make a escape option to false a default, because, i think, users do not use this a lot. If users need to pass true to the escape parameter, they will simply pass it after the rules.
You can also make a vote is it worth it to do so, suddenly I'm wrong.
Have you tried any other work arounds?
No, I haven't found any other work arounds.
Are you willing to work on it with little guidance?
I'm ready to do whatever is necessary to achieve this goal.