netceteragroup/valdr

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

Closed this issue · 2 comments

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.

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 netceteragroup/valdr-bean-validation#28. It'll be part of the upcoming release.