-
Notifications
You must be signed in to change notification settings - Fork 39
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
Make validations context aware #62
Labels
enhancement
New feature or request
Comments
Just came here looking because of the exact same issue. Want to use another field of the object in my validation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently when you want to do a database call or check a value against some set of data, your only option is to wrap the "context" in the builder, e.g.
The result is that a validation is tightly coupled to its "context". This is troublesome especially when the "context" is not constant.
Prettier would be:
The changes in PR #61 allow the user to use a piece of context, with almost no breaking changes for those that don't need any context (the special case, with Unit context). The only breaking change is when you define your own extension function on a ValidationBuilder.
It makes it also possible to combine validations with different contexts (see for example test method
composeValidationsWithContext
):Please consider merging this branch.
The text was updated successfully, but these errors were encountered: