mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-10 16:30:01 +08:00
Fix swagger path generation: remove trailing slash for root routes with prefix (#5212)
This commit is contained in:
@@ -19,7 +19,11 @@ func spec2Paths(ctx Context, srv apiSpec.Service) *spec.Paths {
|
||||
for _, route := range group.Routes {
|
||||
routPath := pathVariable2SwaggerVariable(ctx, route.Path)
|
||||
if len(prefix) > 0 && prefix != "." {
|
||||
routPath = "/" + path.Clean(prefix) + routPath
|
||||
if routPath == "/" {
|
||||
routPath = "/" + path.Clean(prefix)
|
||||
} else {
|
||||
routPath = "/" + path.Clean(prefix) + routPath
|
||||
}
|
||||
}
|
||||
pathItem := spec2Path(ctx, group, route)
|
||||
existPathItem, ok := paths.Paths[routPath]
|
||||
|
||||
Reference in New Issue
Block a user