Skip to content

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

@fridays

Description

@fridays

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions