openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

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

Open Gerschtli opened this issue 1 year ago • 0 comments

Bug Report Checklist

  • [x] Have you provided a full/minimal spec to reproduce the issue?
  • [x] Have you validated the input using an OpenAPI validator (example)?
  • [x] Have you tested with the latest master to confirm the issue still exists?
  • [x] Have you searched for related issues/PRs?
  • [x] What's the actual output vs expected output?
  • [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
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!

Gerschtli avatar Jun 24 '24 15:06 Gerschtli