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

Add an Alternate combinator. #10

Open
logaan opened this issue Jul 2, 2015 · 2 comments
Open

Add an Alternate combinator. #10

logaan opened this issue Jul 2, 2015 · 2 comments

Comments

@logaan
Copy link
Owner

logaan commented Jul 2, 2015

Will allow a value if either valiator passes. As created by @dpom here.

@logaan
Copy link
Owner Author

logaan commented Jul 2, 2015

This could make rendering error messages difficult. Say you want something like "Age must be greater than or equal to 21". If you create the validation by combining equal-to and greater-than then only the error for greater than will be shown (if implemented as seen here).

@logaan
Copy link
Owner Author

logaan commented Jul 7, 2015

Possibly by having errors return in a tree structure that mimics the structure of the validations we could have an error that looks like {:type :alternate :children [{...} {...}]} and then we'll have all the information need to render an error like "Must be [greater than 10] or [equal to 10]". Which is still somewhat awkwardly worded. Perhaps having a :message field on Alternate would help as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant