[BUG][JAVA] SpringCodegen (<library>spring-boot</library>) and BeanValidation for type: string and format: email does not work on version 6.0.1
Created by: JiyangWuUSB
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
We have a property with type: string and format: email and we use Bean Validation for spring-boot.
properties:
email:
type: string
minLength: 1
maxLength: 6
format: email
Using such validations:
<useBeanValidation>true</useBeanValidation>
<performBeanValidation>true</performBeanValidation>
When we call this:
mvn -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true clean install
We got compile error:
Email is ambiguous [ERROR] both class org.hibernate.validator.constraints.Email in org.hibernate.validator.constraints and class javax.validation.constraints.Email in javax.validation.constraints match
while the expected output is: builds and runs successfully
A previous issue addressed the same error [BUG][JAVA] SpringCodegen (spring-boot) and BeanValidation for type: string and format: email does not work #4786
openapi-generator version
6.0.1
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
mvn -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true clean install
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/4786
Suggest a fix
Using version 5.3.1 and 5.4.0 does not cause this error, but 6.0.1 creates this error.
If we set <performBeanValidation>
from true
to false
, the error is gone.
If we comment out the line format: email
, the error is gone.
But we do now know what are the potential downsides of the two methods mentioned above