OpenAPITools / OpenAPITools/openapi-generator

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

Open
#2,906 23 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the attached home.yml and the shown openApiGenerate Gradle configuration using the jaxrs-jersey generator. Inspect the generated model package, including Home.java and the missing OneOfSofa1Sofa2.java class. Done means the OneOf class is generated and the sofaStyle reference resolves successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.