OpenAPITools / OpenAPITools/openapi-generator
[REQ] Improve go-gin-server template
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Hi, I'm gopher, as others already mentioned, go-gin-server has several issues.
I want to make points clear in this issue and discuss it.
Below is my suggestion as a gopher.
- Locate source codes on the root (instead of under
godirectory) - Use separated package for controller or model.
- Controller's implementation which based on request/response definition.
- Bind body with
shouldBindor get parameter withgetParametc... - Return success/error with the corresponding HTTP status and response body.
- Bind body with
- Defined routes with basic methods. Do not use the weird Route struct.
- (Advanced) Add controller struct and define action methods for struct pointers.
- By using controller struct, it's easier to initialize middleware in server bootstrapping.
I have my custom generator to achieve these points on my local already. I can refine it and make a PullReq if someone needs it.
Is it should have the same name or another? go-gin-server2?
Please give me advice and opinion.
I think it's related to #1931 and #2752, #2803. But I filed this issue because these are somewhat outdated.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing go-gin-server template and the related issues #1931, #2752, and #2803. Compare them with the proposed root layout, package separation, controller behavior, route definitions, and optional controller structs. The work is done when the desired template design is agreed and implemented in a pull request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100