mtedone / podam

PODAM - POjo DAta Mocker
https://mtedone.github.io/podam
MIT License
323 stars 750 forks source link

Add support for @Email with BeanValidationStrategy #311

Closed msteiger closed 1 year ago

msteiger commented 1 year ago

Similar to #218 I think that a strategy for EMail strings should be implemented. The docs state that javax.validation.constraints are supported, but it does not yet work for @Email.

I could make a PR similar to what the email example in the docs suggest. Some Latin chars, the at-symbol, some Latin chars, dot, 2-3 Latin chars.

daivanov commented 1 year ago

Hi,

Email was added in Java EE 8, while, we still support only Java EE 7. This would require updating dependencies and drop of Java 6 and Java 7 support.

Thanks, Daniil

msteiger commented 1 year ago

Thanks for the clarification. What about adding the email validator to the package without tying it to the @Email annotation? A bit inconsistent maybe? But maybe helpful enough to be worth it?

I think that it's also possible to compile it properly with @Email annotation on Java 8+ and just set the "targetCompatibility" to 1.7. This should make it work correctly on Java 8 target systems but still be compatible with Java EE 7 (without the @Email functionality).

daivanov commented 1 year ago

Hi,

source and target are not working properly in Oracle Java compiler. Target just sets version to the bytecode without any validation. Then during execution one will get UnsupportedClassVersionError exception. This makes it extremely dangerous feature marginally being useless.

You could do PR and we can think how to merge it smartly.

Thanks, Daniil

daivanov commented 1 year ago

Fixed in Podam 8.0.0 or later

msteiger commented 1 year ago

Very nice! Thank you!