question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] OneOf java classes not getting generated as part of codeGen in gradle plugin 4.0.0

See original GitHub issue

When I generate sever stub for spec having OneOf tags, the code generation gradle task is successful , but in the generated models package OneOf*.java classes are missing.

I am using org.openapitools:openapi-generator-gradle-plugin:4.0.0 for “jaxrs-jersey” generatorName.

For example for below YAML file class “OneOfSofa1Sofa2” is not getting generated , but it is referred for variable “sofaStyle” in generated class Home.java

I have attached the YML as txt home.txt

Below gradle task was used: openApiGenerate { generatorName = "jaxrs-jersey" inputSpec = "$rootDir/src/main/resources/home.yml".toString() outputDir = "$rootDir".toString() apiPackage = "com.home.rest.resources" invokerPackage = "com.home.rest" modelPackage = "com.home.rest.model" modelFilesConstrainedTo = [] configOptions = [ dateLibrary: "java8" ] }

Screenshot of how it looks in editor

Screen Shot 2019-05-16 at 10 26 17 AM

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:18
  • Comments:22 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
Alex118commented, Oct 11, 2019

Same issue here. This is a critical blocker for using openapi generator in our project as we deal with polymorphic APIs.

Has anyone at least found a workaround for this?

2reactions
thSoftcommented, Jan 9, 2021

A (not type-safe) workaround is to enumerate the class names generated from oneOf types in the following command line switches when running the generator: --language-specific-primitives=OneOfTypeATypeB,OneOfTypeCTypeD --type-mappings=OneOfTypeATypeB=java.lang.Object,OneOfTypeCTypeD=java.lang.Object

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use OpenAPI "oneOf" property with openapi-generator ...
I have been battling to generate a PHP client for an API that heavily uses anyOf and oneOf. After some googling and finding...
Read more >
picocli - a mighty tiny command line interface
How it works: annotate your class and picocli initializes it from the command line arguments, converting the input to strongly typed values in...
Read more >
Micronaut and OpenAPI - OpenAPI/Swagger Support
To get started add Micronaut's openapi to the annotation processor scope ... be generated to the META-INF/swagger directory of your project's class output....
Read more >
Chapter 9. Issues Resolved in Fuse 7.0
Issue, Description. ENTESB-3684. New changes are not getting reflected If Switchyard Quickstart are modified and deployed to Fuse 6.2.
Read more >
Confluent Platform Component Changelogs | Confluent ...
Confluent Platform Docker Images will no longer ship with Yum/Apt configuration ... generate new schema id with protobuf; PR-1920 - DGS-404: Improving error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found