Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a common constraint library for jsr 303 (Bean Validation)?

JSR 303 Bean Validation contains out of the box some constrains, but also allow to define custom constrains.

I have the feeling that there are a lot of constraints common for a lot of projects that are not shipped with the JSR implementations.

  • Range for Dates
  • Password Complexity Checks
  • Equals Cross Field Validation (Stack Overflows Highest Voted 'bean-validation' question)
  • ...

So my question is: Is there a (trustworthy) library that contains commons jsr 303 (Bean Validation) constraints?

like image 512
Ralph Avatar asked Feb 12 '13 10:02

Ralph


2 Answers

I'm not aware of a dedicated constraint library, but the JSR 303 reference implementation Hibernate Validator provides several additional constraints, such as @Email, @ScriptAssert, @URL etc. (disclaimer: I'm contributing to Hibernate Validator).

If you have additional ideas or requirements for other constraints, feel free to create a feature request in our JIRA instance.

like image 192
Gunnar Avatar answered Sep 22 '22 12:09

Gunnar


I came to the same result that there is no such library. So I decided to share my little set of common constraints and its validators: https://github.com/malkusch/validation

like image 37
Markus Malkusch Avatar answered Sep 18 '22 12:09

Markus Malkusch