netceteragroup / valdr

A model centric approach to AngularJS form validation
http://netceteragroup.github.io/valdr/
MIT License
153 stars 43 forks source link

Pattern validation is not working with @Pattern definition generated from the java project. #77

Closed callmeberzerker closed 9 years ago

callmeberzerker commented 9 years ago

Here is a sample @Pattern definition:

{"flags":[],"regexp":"/((?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{8,100})/","message":"{javax.validation.constraints.Pattern.message}"}

We can see that the regex is being stored in "regexp" field, NOT in constraint.value as seen in valdr.js L427. (var pattern = asRegExp(constraint.value))

Don't know who should fix this, the integrating project that is generating the @Pattern annotation definition or valdr.js.

marcelstoer commented 9 years ago

According to https://github.com/netceteragroup/valdr#pattern the field is called value and not regexp.

There was a related bug in valdr-bean-validation which was fixed with https://github.com/netceteragroup/valdr-bean-validation/pull/28. It'll be part of the upcoming release.

philippd commented 9 years ago

Fixed in valdr-bean-validation 1.1.2: https://github.com/netceteragroup/valdr-bean-validation/releases/tag/valdr-bean-validation-parent-1.1.2