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
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Switching from go-server to go-gin-server, I am surprised to see invalid models generated. I'm unable to switch to the gin server without manually editing the code after generation.
Empty struct is generated regardless of the type of model required in the yaml file. In my case,
I'm trying to generate models with a list of strings and a string map with "additional attributes", and the generated code is unusable since they are just an empty struct.
Steps to reproduce
Start with openapi yaml file with a list of strings defined.
Generate with go-gin-server
Observe that list of strings and string map are generated as empty structs
If you use my demo gist, you can run "make generate"
Related issues/PRs
There are a couple PRs related to improving the go-gin-server template, although not directly to empty struct generation.
This template lacks features that are found in the go-server template -- particularly the primitive type generation. I suspect a lot of the go-server model could be re-used in the go-gin-server template.
I'd be willing to sponsor the work.
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
Switching from go-server to go-gin-server, I am surprised to see invalid models generated. I'm unable to switch to the gin server without manually editing the code after generation.
openapi-generator version
OpenAPI declaration file content or url
bug is demonstrated in gist:
https://gist.github.com/coryschwartz/4b3674d8493e3398be9858993efa57f6
Generation Details
Empty struct is generated regardless of the type of model required in the yaml file. In my case,
I'm trying to generate models with a list of strings and a string map with "additional attributes", and the generated code is unusable since they are just an empty struct.
Steps to reproduce
Start with openapi yaml file with a list of strings defined.
Generate with go-gin-server
Observe that list of strings and string map are generated as empty structs
If you use my demo gist, you can run "make generate"
Related issues/PRs
There are a couple PRs related to improving the go-gin-server template, although not directly to empty struct generation.
#7280
#10429
Suggest a fix
The mustache file in question is this one: https://github.com/OpenAPITools/openapi-generator/blob/v7.4.0/modules/openapi-generator/src/main/resources/go-gin-server/model.mustache
This template lacks features that are found in the go-server template -- particularly the primitive type generation. I suspect a lot of the go-server model could be re-used in the go-gin-server template.
I'd be willing to sponsor the work.
The text was updated successfully, but these errors were encountered: