Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (actual)?
- 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
We're expecting that all properties of objects referenced in a oneOf
should be added to the generated composed class when using the webclient library. Instead the first object referenced will never have its properties added to the composed class.
Running Verbose logging on the 7.14.0-SNAPSHOT version indicates that the properties of the first object in a oneOf
are in the allVars, optionalVars, readWriteVars, and nonNullableVars. But not the vars property in the logged JSON.
openapi-generator version
7.11.0 through 7.14.0-SNAPSHOT of the Maven plugin, haven't tried older versions yet to determine if its a regression.
7.14.0-SNAPSHOT with a locally built version of the cli version.
OpenAPI declaration file content or url
Generation Details
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i https://gist.githubusercontent.com/Yajirushi12/e681738f2bd9a6aa26af04886c78770d/raw/0d6600dda04553a6d2d09eaa789da01e0f93d9a0/test.yml -g java -o samples/client/brokenOneOf --library webclient
the default library seems to work properly for Java, at least in that it doesn't compose the properties into a single class so its not susceptible to this bug
Steps to reproduce
Run the above generation. Modifying the order of the references in the oneOf
in either the schemas object or the response body definition will result in the object that's first first in the list never having its property added to the composed class
Related issues/PRs
I didn't see any that looked related to not generating in this way, though I might be wrong.
Suggest a fix
Working on getting approval to use employer time to develop a fix for this, not sure exactly where the problem is in the generation process though it seems like it might be originating from a problem related to copying properties and dealing with the parent of the object in the DefaultCodegen file somewhere.