OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When generating code for models that contain anyOf properties, the resulting deserializers don't always return the correct response type. The first time input JSON is deserialized, the resulting instance can be of the wrong type.
Generation files are included in the gist: the pom.xml defines how the openapi-spec.yaml is to be turned into classes, and the DifficultTest.java shows the issue.
Related issues/PRs
Couldn't find any
Suggest a fix
I'll push a branch with a potential fix in the generation mustache files.
Bug Report Checklist
Description
When generating code for models that contain
anyOf
properties, the resulting deserializers don't always return the correct response type. The first time input JSON is deserialized, the resulting instance can be of the wrong type.openapi-generator version
Version 7.6.0 and before.
OpenAPI declaration file content or url
https://gist.github.com/qbuzzdaan/d4348d1786e4d519a60df6e3790580ed
Generation Details
n/a
Steps to reproduce
Generation files are included in the gist: the
pom.xml
defines how theopenapi-spec.yaml
is to be turned into classes, and theDifficultTest.java
shows the issue.Related issues/PRs
Couldn't find any
Suggest a fix
I'll push a branch with a potential fix in the generation mustache files.