OpenAPITools / OpenAPITools/openapi-generator
[BUG][JAVA] openapi-generator version >= 6.2 doesn't generate examples for allOf attributes
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
Generate the open api json using openapi-generator-cli-6.2.0.jar or above and it doesn't generate examples for allOf attribute.
When viewed with swagger viewer, the example shows 'null', whereas the expectation is a json generated by combining all the schema's of allOf with values as datatypes. Its working fine in openapi-generator-cli-6.1.0.jar
Behavior in 6.2 and above

Expected behavior

openapi-generator version
Seen in openapi-generator-cli-6.2.0.jar - openapi-generator-cli-6.3.0.jar
Steps to reproduce
compile the spec yaml using openapi-generator-cli-6.2.0.jar or above and it will generate the json with example null
java -jar openapi-generator-cli-6.2.0.jar generate -i api-spec/openapi.yaml -g openapi -o api-spec/static --additional-properties outputFileName=openapi.json;
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with api-spec/openapi.yaml and reproduce the issue using the documented Java command with openapi-generator-cli 6.1.0, 6.2.0, and 6.3.0. Compare the generated api-spec/static/openapi.json output for an allOf schema. Done means the generated example combines the allOf schemas with datatype values instead of null, with coverage for the regression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100