Skip to content

[BUG] Generating models with enum discriminator #16073

@isaac33zhang

Description

@isaac33zhang

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

The model for an object with an enum discriminator generates a constructor that causes a compilation error. Related issue in swagger-codegen: swagger-api/swagger-codegen#10441
For Enum type discriminator, a constructor is being generated that assigns a string to the enum discriminator. For example:
public ExternalKeySpecDetails() { this.ekmType = this.getClass().getSimpleName(); }

openapi-generator version

4.0.1

OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs

swagger-api/swagger-codegen#10441

Suggest a fix

It doesn't seem the constructor is used anywhere. Can we just get rid of it during the generation?

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