You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating code from a spec that has a schema definition without properties, something is converting it to a generic object. I'm not sure if this affects other generators or just PHP.
This causes a problem for me generating code for Marketo's API which does this. Many of their Schema's are dynamic and populated with fields from your custom objects. This doesn't "work" out of the box with codegen but its not difficult at least in PHP to modify the model interfaces and Serialization to support this. It also looks like #6290 is starting to add this as a generic feature fixing this might be a requirement for supporting edge cases in that.
By flatting it like this though it becomes much more difficult because there isn't a model. Additionally this isn't ideal because the code diverges from the openapi documentation.
For example. in the 3.x branch the return looks like this: * @return \OpenAPI\Client\Model\ModelResponse
in 4.x and beyond it looks like this: * @return object
This is the value in returnType so its in docs, apis, etc and can't be fixed in a templates.
openapi-generator version
v4.0.0+
Tested with docker versions v3.3.4, 4.0.0, 4.3.1, and latest. it seems to exist in all releases after v4.0.0
Bug Report Checklist
Description
When generating code from a spec that has a schema definition without properties, something is converting it to a generic object. I'm not sure if this affects other generators or just PHP.
This causes a problem for me generating code for Marketo's API which does this. Many of their Schema's are dynamic and populated with fields from your custom objects. This doesn't "work" out of the box with codegen but its not difficult at least in PHP to modify the model interfaces and Serialization to support this. It also looks like #6290 is starting to add this as a generic feature fixing this might be a requirement for supporting edge cases in that.
By flatting it like this though it becomes much more difficult because there isn't a model. Additionally this isn't ideal because the code diverges from the openapi documentation.
For example. in the 3.x branch the return looks like this:
* @return \OpenAPI\Client\Model\ModelResponse
in 4.x and beyond it looks like this:
* @return object
This is the value in
returnType
so its in docs, apis, etc and can't be fixed in a templates.openapi-generator version
v4.0.0+
Tested with docker versions v3.3.4, 4.0.0, 4.3.1, and latest. it seems to exist in all releases after v4.0.0
OpenAPI declaration file content
ModelResponse object on https://developers.marketo.com/swagger/swagger-asset.json
Simplified.
Command line used for generation
docker run --rm -v ${PWD}:/local/ openapitools/openapi-generator-cli:v4.3.1 generate \ -i /local/object_bug.yaml -g php -o /local/.build
Steps to reproduce
Related issues/PRs
?
Suggest a fix
Always return the documented model.
The text was updated successfully, but these errors were encountered: