Skip to content

[BUG] [java] [resttemplate] Generated alias models missing JsonTypeName import #8157

@mikesaurus

Description

@mikesaurus
Description

When generating client code with openapi-generator and the generateAliasAsModel option set to true, model classes generated from aliases are missing an import statement for the JsonTypeName annotation and fail to compile.

openapi-generator version

5.0.0-x

OpenAPI declaration file content or url

Example swagger contract.

Generation Details

The code is being generated using the Maven plugin. See example project.

Steps to reproduce
  1. See example project README.
  2. Change the openapi-generator-maven-plugin.version in the POM file to any 5.0.0-x version and build.
Related issues/PRs

None.

Suggest a fix

Include the JsonTypeName import for both standard and alias model classes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions