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

Feature Request: provide inline validation function in options #518

Closed
mwpastore opened this issue Jul 27, 2017 · 3 comments
Closed

Feature Request: provide inline validation function in options #518

mwpastore opened this issue Jul 27, 2017 · 3 comments

Comments

@mwpastore
Copy link

If you have a really hairy inline validation function, it would be neat if you could pass it along in the options hash instead of as the first parameter. Something like this:

foo: validator({
  validate(value, options, model, attribute) {
    // hairy monstrosity goes here
  }
})

Or, to maintain a consistent API:

foo: validator('inline', {
  validate(value, options, model, attribute) {
    // ..
  }
})
@offirgolan
Copy link
Collaborator

I agree with you @mwpastore, this will definitely create a more uniform API. I would need to write a backwards compatible way of doing this which shouldnt be too hard but I just dont have the time right now.

In terms of a really hairy inline validation function, I would suggest using a custom validator instead 😄

@mwpastore
Copy link
Author

@offirgolan It looks like you implemented this in #569?

@offirgolan
Copy link
Collaborator

@mwpastore yup! Will be released with v4.0.0 😄

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