Hey Kevan using method based validation is still a bit cumbersome. The biggest problem I see is the lack of a property path when a method parameter is validated.
To fix this, I introduced an annotation @ParamName which I inspect after a violation has been determined. As we use this to validate REST method calls (JAX-RS), I also inspect whether there has been a @QueryParam or @PathParam on the parameter violating a constraint. The problem with my approach is that I have to validate parameter by parameter separately to be able to determine which parameter(s) violated. I didn't see a name or parameter index helping me associate parameter violations to parameters. I would prefer to only call validate on the method passing all parameters and retrieving a unique identifier for a parameter in its constraintviolation. Chris On Dec 8, 2010, at 6:24 PM, Kevan Miller wrote: > > On Dec 3, 2010, at 9:45 AM, Christian Ey wrote: > >> Hey Bean Validators, >> >> In my current project, I am trying to switch to Apache Bean Validation >> instead of Hibernate, because I would like to introduce method parameter >> validation. >> >> Unfortunately, there seems to be a blocking bug in Apache Bean Validation, >> where I get constraint violations where I shouldn't if I validate objects >> which contain other beans recursively. This breaks existing unit tests which >> pass with Hibernate validation. >> >> I described the problem in https://issues.apache.org/jira/browse/BVAL-88 and >> also proposed a fix for it there, which unblocks me locally, but I can't >> work with a locally patched version, it would not get approved to be put in >> my customer's repo. >> >> Is it possible to submit the fix? > > Hi Christian, > I see you've submitted a patch to your Jira -- THANKS! That's the way best > way to submit fixes to the project. > > Would be interested to hear your experiences with method parameter > validation. > > --kevan
