OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.42k stars 6.48k forks source link

[BUG][Java][jaxrs-spec] When using discriminator, enum properties of children are defined in parent instead of child class #19009

Open Gerschtli opened 3 months ago

Gerschtli commented 3 months ago

Bug Report Checklist

Description

When I define a schema with discriminator and a child has an enum property, the enum definition and the property is generated into the parent and therefore available for all other children. This also results in a compile error when generating the equals and hashCode methods.

This issue is currently blocking any updates of this generator for me.

openapi-generator version

I tried the latest master (7.7.0-20240520.095624). It worked with 7.2.0 and is broken since 7.3.0

OpenAPI declaration file content or url

https://gist.github.com/Gerschtli/197faf5d172bcaf63d08cedaa364107f

Generation Details
java -jar openapi-generator.jar generate -g jaxrs-spec -i spec.yaml
Steps to reproduce

Use provided spec.yaml and generate java code with the command from above.

Related issues/PRs

I did not find any related Issues/PRs.

Suggest a fix

I don't have any workaround. As this is currently blocking me, any workaround would be appreciated!