-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Golang][go-gin-server]can not use the param of the path #1122
Comments
I am sorry that the operation check was insufficient. I'll try fix this. I will try to refer to |
Hmm.. By modifying Server started
[GIN-debug] [WARNING] Now Gin requires Go 1.6 or later and Go 1.7 will be required soon.
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
[GIN-debug] GET /v2/ --> github.com/kemokemo/go-gin-server/go.Index (3 handlers)
[GIN-debug] POST /v2/pet --> github.com/kemokemo/go-gin-server/go.AddPet (3 handlers)
[GIN-debug] DELETE /v2/pet/:petId --> github.com/kemokemo/go-gin-server/go.DeletePet (3 handlers)
[GIN-debug] GET /v2/pet/findByStatus --> github.com/kemokemo/go-gin-server/go.FindPetsByStatus (3 handlers)
[GIN-debug] GET /v2/pet/findByTags --> github.com/kemokemo/go-gin-server/go.FindPetsByTags (3 handlers)
[GIN-debug] GET /v2/pet/:petId --> github.com/kemokemo/go-gin-server/go.GetPetById (3 handlers)
panic: wildcard route ':petId' conflicts with existing children in path '/v2/pet/:petId' The endpoint Is this disqualified as a generator? |
The other generators (e.g. finch) has a similar patch to correct the path parameter. Let me know if you need the code snippet to fix the same in the Go Gin generator. |
We can document this in the auto-generated README as a known issue with a reference to gin-gonic/gin#388 Users can manually fix it by updating the path to workaround the issue for the time being. |
@wing328 Thank you so much for your advise! I will post a PR with the following changes.
|
Description
The path with param does not be generated properly. ex)
/pet/{petId}
openapi-generator version
3.3.0-SNAPSHOT
(master)
OpenAPI declaration file content or url
extracted_petstore.yaml
Command line used for generation
Steps to reproduce
Related issues/PRs
Issue #1047
PR #1048
Suggest a fix/enhancement
routers.go
generated by the current master.This code should be below:
The text was updated successfully, but these errors were encountered: