swagger-api / swagger-api/swagger-codegen
[go] Path of the remote file added to the pattern when generating a server
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When using option -i to grab the specs from the web to generate a server, the path of the specs is added to the Route pattern
The command used is
swagger-codegen generate -i https://forge.3gpp.org/rep/all/5G_APIs/-/blob/Rel17-draft-TSG96/TS29122_PfdManagement.yaml -l go-server -o server
The result at routers.go is
var routes = Routes{
Route{
"Index",
"GET",
"/rep/all/5G_APIs/-/raw/Rel17-draft-TSG96//TS29122_PfdManagement.yaml/",
Index,
},
Route{
"DeleteIndApplicationPFDManagement",
strings.ToUpper("Delete"),
"/rep/all/5G_APIs/-/raw/Rel17-draft-TSG96//TS29122_PfdManagement.yaml/{scsAsId}/transactions/{transactionId}/applications/{appId}",
DeleteIndApplicationPFDManagement,
},
...
As you can see the 3rd argument on the Route (pattern) includes the path of the file we used
Swagger-codegen version
3.0.34
Swagger declaration file content or url
https://forge.3gpp.org/rep/all/5G_APIs/-/blob/Rel17-draft-TSG96/TS29122_PfdManagement.yaml
Command line used for generation
swagger-codegen generate -i https://forge.3gpp.org/rep/all/5G_APIs/-/blob/Rel17-draft-TSG96/TS29122_PfdManagement.yaml -l go-server -o server
Steps to reproduce
check routers.go
Related issues/PRs
Suggest a fix/enhancement
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
Reproduce the issue with the provided swagger-codegen command and inspect the generated routers.go. Compare the route patterns with the paths in the remote OpenAPI specification; done means the generated patterns contain the API routes without the remote file path prefix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100