Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #13379
Closed
Open
Issue created Sep 07, 2022 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[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

Assignee
Assign to
Time tracking