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

Multiple validators for properties in an object #2

Open
mkeedlinger opened this issue Aug 19, 2014 · 1 comment
Open

Multiple validators for properties in an object #2

mkeedlinger opened this issue Aug 19, 2014 · 1 comment

Comments

@mkeedlinger
Copy link

If I want to have scheme like this:

scheme = {
    host: schema.isString,
    password: schema.minLength([10])
}

I can't check if host is both a longer than 5 and shorter than 10.

Either using multiple validators on a single property could be a really cool new feature or I'm missing something

@ron-liu-catch
Copy link

Yes, you can apply multiple validators on single property, like:
scheme = {
host: [schema.isString, schema.minLength(5), schema.maxLength(10)]
password: schema.minLength([10])
}

That probably meet what you want.

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

No branches or pull requests

2 participants