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

Vex.Validator.Source.check(validator) only verifies validate/2 #47

Open
jfornoff opened this issue Nov 5, 2017 · 0 comments
Open

Vex.Validator.Source.check(validator) only verifies validate/2 #47

jfornoff opened this issue Nov 5, 2017 · 0 comments

Comments

@jfornoff
Copy link
Collaborator

jfornoff commented Nov 5, 2017

I believe that the verification logic for validator modules is missing a case for validators that use validate/3 instead of validate/2.

Technically, how I perceive the logic to be working is:

  • validate/3 is called at runtime
  • use Vex.Validator defines a default validate/3 that delegates to validate/2, discarding the context attribute
  • When looking up validators by name (done in Vex.validator/1), Vex.Validator.Sources encodes what is considered a complete validator module: exporting validate/2

However, this verification assumes that validate/3 is the not overridden and the default implementation delegates to validate/2, otherwise it would be perfectly reasonable to not have validate/2 and instead just defining validate/3

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