[BUG] Java oneof Classes are not generated
See original GitHub issueDescription
(Thanks for fantastic tool!)
I expect OneOfGeographicLocationGeographicLocationRef.java be created.
Actual: no such file is generated
openapi-generator version
Tried with
- 4.3.1
- openapi-generator-cli-5.0.0-20200813.162255-527.jar
OpenAPI declaration file content or url
Generation Details
openapi-generator generate -I Swagger.json.txt -g jaxrs-cxf-client
Steps to reproduce
Run above command, you’ll get src/gen/java/org/openapitools/model/GeographicLocation.java which contains
import org.openapitools.model.OneOfGeographicLocationGeographicLocationRef;
But no such class was generated.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:9 (4 by maintainers)
Top Results From Across the Web
[BUG][Java] OneOf-Class not generated #10880 - GitHub
A workaround seems to be to rewrite the spec file to introduce an explicit wrapper class. The class can use oneOf successfully. For...
Read more >OpenAPI models not being generated when using oneOf
I have oneOf generation working for java using openapi-generator 5.4.0 but I do add a discriminator field (like requestType: type: string enum: ...
Read more >Java Generated Code | Protocol Buffers - Google Developers
The protocol buffer compiler generates a class called Foo , which implements the Message interface. The class is declared final ; no further...
Read more >Documentation for the spring Generator
Generates a Java SpringBoot Server application using the SpringDoc integration. #CONFIG OPTIONS. These options may be applied as additional- ...
Read more >Swagger OpenAPI Code Gen "oneOf" : How to generate...
TLDR: Swagger offers a feature named 'oneOf'. The resulting java classes created do not seem to be correct. Details: I am creating the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@seybi87 I just got back to this today and need a compiling JAR. I think this will work (about to test it, and I’ll report back here):
Deserialization would have non-deterministic behavior if both
apiKey
anduser
were present in the JSON document, though. Not sure how to handle that for a proper PR here. I suppose aJsonDeserializer
would have access to the entire tree at the time of deserialization, so it could throw. Thoughts on that part @wing328 ?java
(library: jersey2, native, okhttp-gson) has better support of oneOf and anyOf.We welcome contributions to plot the implementation to other java clients (
jaxrs-cxf-client
)