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

Dependent validators #15

Open
stevegraham opened this issue Sep 11, 2015 · 0 comments
Open

Dependent validators #15

stevegraham opened this issue Sep 11, 2015 · 0 comments

Comments

@stevegraham
Copy link

I'm currently using Vex.Struct to build form models in my Phoenix application. The library is extremely useful, thanks for releasing it. One thing I'd like to do is dependent validations, i.e. validations that depend on some other field in the struct. Currently this is not possible as Vex passes only the value of the field under test into the validate function. It would be cool if it worked in a similar way ActiveModel::EachValidator in Rails, i.e. the validation receives the entire struct as context as well as the value under test. This would also have the benefit of enabling the confirmation validator without Vex.extract/3 treating it as a special case.

I intend to contribute a patch myself, but first I want to get your thoughts on the best approach, backwards compatibility considerations re the existing Vex.Validator.Behaviour, etc.

What do you think?

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