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
This is wrong as it suggests that the return value is a 2-tuple.
openapi-generator version
Happens both in 4.0.0-beta3 and 3.3.4
OpenAPI declaration file content or url
I'm honestly not sure how to find a reproducer for this. It happens with openapi-generator installed through npm, but I can't reproduce it on the petstore example, where the generated operations really do seem to return 2-tuples.
which suggests that the first return value only gets rendered if {{returnType}} is defined, but the README doesn't take this into account. However I'm not sure where this value comes from and why I can't reproduce on the petstore example.
Command line used for generation
openapi-generator generate -g go -c config/languages/go.json -i spec/full_spec.yaml -o generated/myclient
Steps to reproduce
For me, the reproducer is just running the above command.
Related issues/PRs
I haven't found any.
Suggest a fix
I think that taking the {{returnValue}} variable into account in the README example should fix this.
The text was updated successfully, but these errors were encountered:
So I've done some more digging and unfortunately it's more complicated than that.
IIUC the {{returnType}} value is set per-operation in DefaultCodegen.fromOperation and is only set when responseSchema for that operation is set. That's why I'm getting the 3-tuples as return values (I have these defined everywhere) and the petstore example doesn't get these everywhere (it only has response schemas defined on some operations). This means that depending on the spec, this can vary throughout the generated codebase and can be mixture of both inside one generated client.
I'm not 100 % sure what would be the best course of action here. If backwards compatibility is to be preserved, we have to always work with the possibility of having both 3-tuples and 2-tuples returned in any given client. Hence the README.md should probably be modified to reflect that this is operation dependent and the user should refer to the specific operation documentation. Does this make sense?
Bug Report Checklist
Description
All my operations are generated with a return signature that is a 3-tuple, for example:
README.md however lists this as an example:
This is wrong as it suggests that the return value is a 2-tuple.
openapi-generator version
Happens both in 4.0.0-beta3 and 3.3.4
OpenAPI declaration file content or url
I'm honestly not sure how to find a reproducer for this. It happens with openapi-generator installed through npm, but I can't reproduce it on the petstore example, where the generated operations really do seem to return 2-tuples.
The template
go/api.mustache
does have this:which suggests that the first return value only gets rendered if
{{returnType}}
is defined, but the README doesn't take this into account. However I'm not sure where this value comes from and why I can't reproduce on the petstore example.Command line used for generation
openapi-generator generate -g go -c config/languages/go.json -i spec/full_spec.yaml -o generated/myclient
Steps to reproduce
For me, the reproducer is just running the above command.
Related issues/PRs
I haven't found any.
Suggest a fix
I think that taking the
{{returnValue}}
variable into account in the README example should fix this.The text was updated successfully, but these errors were encountered: