Support shorthand definitions of validators
WangLarry opened this issue · comments
Is your feature request related to a problem? Please describe.
Current validators of Jafar are defined by object, which is appropriate for designer and builder tools. But sometimes it is not for programmer.
Describe the solution you'd like
Shorthand definitions are necessary.
Describe alternatives you've considered
Moleculer has a validator, which support shorthand definitions.
const schema = {
password: "string|min:6",
age: "number|optional|integer|positive|min:0|max:99", // additional properties
state: ["boolean", "number|min:0|max:1"] // multiple types
}
BTW: it is also for Exclude/Disable/Require.
@WangLarry Interesting :)
We do have some shorthand definitions
But I guess you suggest to have even more short definition...(describe a field with a single string row?)
Ill give it a thought to see how it can be done :)
any suggestions are welcome as well !
Yes, more shorter :)