| Agreed, that an attribute within the annotations would be much more descriptive and explicit, and indeed it would be our preferred approach. The problem only is that we can't alter the constraints defined by the spec @PastOrPresent etc. without a new revision (Bean Validation 2.1). In the context of
HV-1493 Closed we explored approaches for what could be done until then, but nothing is satisfactory, e.g. you could have a separate auxiliary annotation next to such temporal constraint which would specify the accepted tolerance, but then there's no good way to unambigously speficy the targeted constraint in case there are multiple ones on the same element (e.g. in different validation groups). Therefore we settled on the global option for the time being, but it's definitely something which we can re-visit for Bean Validation 2.1 (whenever that will be done), by adding the required attributes to the constraints in the spec API itself. |