Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support shorthand definitions of validators #71

Open
WangLarry opened this issue Jul 11, 2020 · 3 comments
Open

Support shorthand definitions of validators #71

WangLarry opened this issue Jul 11, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@WangLarry
Copy link

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
}
@WangLarry
Copy link
Author

BTW: it is also for Exclude/Disable/Require.

@galhavivi
Copy link
Member

galhavivi commented Jul 11, 2020

@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 !

@galhavivi galhavivi added the enhancement New feature or request label Jul 11, 2020
@WangLarry
Copy link
Author

Yes, more shorter :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants