-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
If an inline oneOf or anyOf definition is used below an allOf or oneOf, the generated code will contain the name of the inline defined structure, but the structure itself will not be generated.
If the schema is rearranged to avoid using the inline definition, the missing part is also generated.
One possible way to do this is to define the inline oneOf or anyOf at the top level and reference it from below allOf or oneOf.
openapi-generator version
6.4.0
OpenAPI declaration file content or url
oneOf below allOf
Inline version
Referenced version
anyOf below oneOf
Inline version
Referenced version
Generation Details
Nothing special is needed beyond the steps specified in the next section. That is, download the 4 samples and compile them with the linked generator. Two of the samples are the wrongly compilable inline version, while two of them are the properly compilable referenced version.
Steps to reproduce
- Download the gists linked above
- Download the generator script also
- Run the script
generate.sh - Recognise that
AnyOfstringstringis missing fromgo-anyOf-below-oneOf-inlinedirectory, while it is referenced inmodel_b.goOneOfDEandNullableOneOfDEare missing fromgo-oneOf-below-allOf-inlinedirectory, while it is referenced inmodel_a_all_of_attributes.go- The generated openapi.yaml files are not the same by byte, but they cover practically the same structure