OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
I know too little java and internals of how this system works. But basically calls to GenericOpenAPIError{/* ... */} should always be pointers &GenericOpenAPIError{ /* ... */ }. Same for API return values.
I see that this is partially a duplicate - however the other issues and fixes do not appear to talk about the response values, only errors. Response values should also be pointers because:
Response values are empty if an error occurs and should thus be nil
There is no point in having pass-by-value as the original value is not used anywhere else - it is created during the call to Execute
Bug Report Checklist
Description
Generating a Go-client yields in code that does not adhere to Golang's error handling. Request executors return
GenericOpenAPIError
as a value:which makes it impossible to check if
err != nil
as the variable is a value (and thus always not nil) and not a pointer. Instead, this should read:The same applies to return values which should also be pointers, not structs:
should be:
openapi-generator version
5.0.0
OpenAPI declaration file content or url
https://gist.github.com/aeneasr/3c11c5b454df6c5e4d8e7a3e16d04db7
Generation Details
Steps to reproduce
See above.
Related issues/PRs
Suggest a fix
I know too little java and internals of how this system works. But basically calls to
GenericOpenAPIError{/* ... */}
should always be pointers&GenericOpenAPIError{ /* ... */ }
. Same for API return values.