Bug Report Checklist
Description
When generating a spring or java code with a spec that contains an attribute with oneOf, the code generator creates a code with a bug
Spec: https://gist.github.com/wagnerrobsan/88d81d113d4add401667e64ab814e3aa
Creates the following java code:
public Fruit putBodyItem(String key, bodyItem) {
if (this.body == null) {
this.body = ;
}
this.body.put(key, bodyItem);
return this;
}
openapi-generator version
latest version, build from master
OpenAPI declaration file content or url
Providing minimal reproducing example (YAML):
Spec: https://gist.github.com/wagnerrobsan/88d81d113d4add401667e64ab814e3aa
Generation Details
see Steps to reproduce for more details
Steps to reproduce
git clone https://github.com/openapitools/openapi-generator
cd openapi-generator
mvn clean package
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-i https://gist.githubusercontent.com/wagnerrobsan/88d81d113d4add401667e64ab814e3aa/raw/ab969d651c60e76be6b44ba69950c77b9992c108/openapi-oneOfbug.yaml \
-g spring \
-o /outputFolder/oneOfBugApiClient
Related issues/PRs
Related to
Suggest a fix
The code generator should skip in the mustache file the putBodyItem method creation.
see file JavaSpring/pojo.mustache
Bug Report Checklist
Description
When generating a spring or java code with a spec that contains an attribute with oneOf, the code generator creates a code with a bug
Spec: https://gist.github.com/wagnerrobsan/88d81d113d4add401667e64ab814e3aa
Creates the following java code:
openapi-generator version
latest version, build from master
OpenAPI declaration file content or url
Providing minimal reproducing example (YAML):
Spec: https://gist.github.com/wagnerrobsan/88d81d113d4add401667e64ab814e3aa
Generation Details
see
Steps to reproducefor more detailsSteps to reproduce
git clone https://github.com/openapitools/openapi-generatorcd openapi-generatormvn clean packagejava -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \-i https://gist.githubusercontent.com/wagnerrobsan/88d81d113d4add401667e64ab814e3aa/raw/ab969d651c60e76be6b44ba69950c77b9992c108/openapi-oneOfbug.yaml \-g spring \-o /outputFolder/oneOfBugApiClientRelated issues/PRs
Related to
Suggest a fix
The code generator should skip in the mustache file the putBodyItem method creation.
see file JavaSpring/pojo.mustache