feat(): validation involving multiple fields
See original GitHub issueHi,
I really like the approach YAVI take to simplify the bean validation, but I would like to know how (and if it is possible simply) we can do a “two field validation”
For example:
data class Foo(val min: Int, val max: Int) // very simple model, can happen on more than two fields with more than one type
I would like to be valid only if min
is smaller than max
. I don’t find anything about it in the current API which is very annoying for me because a huge part of my business domain has this kind of (form) validation on our class.
I find a solution by transforming the value to Map
then doing the validation on each value… but it’s not very efficient (putting into a map and then extracting it)
Thanks for your help
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
java - How can I validate two or more fields in combination?
I now have a situation where the combination of two fields has to be validated: public class MyModel { public Integer getValue1() {...
Read more >How to handle validations involving several fields?
It's often enough to validate each field in isolation: * email should contain a @; * password should be more than four characters....
Read more >feat: add option to define class level custom decorators #182
I created a decorator already, but it's bound to the field and not the class, so I lack access to multiple fields. ......
Read more >Cross field validation in Spring and JEE - | Dev in Web
Learn how to validate related parameters of request together in Spring or JEE application. See a class level cross field validator in ...
Read more >User Input Validation in Razor Pages
Input Validation is the process whereby you ensure that values provided by the user of your Razor Pages web site are of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t know if it’s simply possible, but I propose something like this (the name of the method can be changed, I don’t have enough imagination 😊)
I don’t know if all the parameters are required here (especially the
max
), but if not, we can remove it.will be released in 0.20.0 I really appreciate your feedback