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.49k stars 6.5k forks source link

[BUG][JAXRS-spec] useOneOfInterfaces option causes compilation error #17419

Open jerui1 opened 9 months ago

jerui1 commented 9 months ago
Description

When using the useOneOfInterfaces option, the generated code does not compile.

Children classes are OK, but the generated parent is a class instead of an interface.

openapi-generator version

I've reproduces the issue with openapi-generator-maven-plugin : 7.0.1, 7.1.0 6.6.0

The option does not seem supported on previous releases.

OpenAPI declaration file content or url

OpenAPI spec :

https://gist.github.com/jerui1/da605832f67667e32a96f5c4d346640e

Sample maven project to reproduce :

openapigen-oneofbug.zip

Generation Details

mvn clean install

(I've tried using Java 17 or Java 21)

mikeys commented 8 months ago

Reproduced on openapi-generator v7.2.0

parawanderer commented 7 months ago

The issue still occurs with openapi-generator v7.3.0

lucadirocco commented 7 months ago

The same issue also occurs with jaxrs-resteasy generator (--additional-properties=useOneOfInterfaces=true). The expected interface for the oneOf schema is not generated and a class with the same name is generated in its place. However, the classes generated for the subschemas correctly implement the intended interface.

jamfor352 commented 3 months ago

This has been open for 6 months without any resolution, is anyone maintaining this?

magiusdarrigo commented 1 week ago

This is still an issue in v7.8.0

magiusdarrigo commented 1 week ago

Likely root cause issue - https://github.com/OpenAPITools/openapi-generator/issues/14166