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
  • #11492
Closed
Open
Issue created Feb 02, 2022 by Administrator@rootContributor1 of 1 checklist item completed1/1 checklist item

[BUG][Java] duplicate @JsonTypeName annotation

Created by: cachescrubber

Bug Report Checklist

  • Have you tested with the latest master to confirm the issue still exists?
  • [x ] Have you searched for related issues/PRs?
Description

If a Spec uses inheritance, and a Schema is considered to be sanitised (isClassnameSanitized is true) the java generator will generate a duplicate @JsonTypeName("Model_Name")annotation.

See Java/pojo.mustache and Java/typeInfoAnnotation.mustache.

openapi-generator version

5.4.0

Suggest a fix

I'm happy to provide PR with a fix, but would like to discuss prior with the core team and / or Java technical committee wether to unconditionally include @JsonTypeName or use the isClassnameSanitized condition.

{{#isClassnameSanitized}}
@JsonTypeName("{{name}}")
{{/isClassnameSanitized}}
Assignee
Assign to
Time tracking