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

Array of custom validators only works if each validator is wrapped in an object #331

Open
fridays opened this issue Mar 19, 2016 · 0 comments

Comments

@fridays
Copy link

fridays commented Mar 19, 2016

I have an array of custom validator functions and tried this in the model:

validation: {
  name: [validate.required, validate.user.name]
}

But it only works if I do this:

validation: {
  name: [{ fn: validate.required }, { fn: validate.user.name }]
}

When only a single validator is provided, the library internally wraps it in an object { fn: attrValidation }. But when an array of validators is provided, the library doesn't do this and expects each item to be already wrapped in this structure.

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

1 participant