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

Can't validate Array #34

Open
leaves4j opened this issue Mar 29, 2018 · 2 comments
Open

Can't validate Array #34

leaves4j opened this issue Mar 29, 2018 · 2 comments

Comments

@leaves4j
Copy link

const arr = [{ key: ' ' }];
const rules = {};
validate(rules, arr);

No matter how to set the rule can not validate the array

@paranoidjk
Copy link
Contributor

You can wrap array to a object, then pass it to parameter https://github.com/node-modules/parameter#array

@BkunS
Copy link

BkunS commented Mar 16, 2019

Of course you could wrap everything into an object as a "work around", but this somehow makes options.validateRoot default to false a little confusing and misleading: by giving an impression that it could validate something other than objects, such as arrays.

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

3 participants