Merge pull request #54 from bensonfx/fix_prefix_not_start_with_slash

fix prefix not start with /
This commit is contained in:
MaxToby 2022-09-28 01:34:41 +08:00 committed by GitHub
commit 3ff75d22a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,8 +99,10 @@ func applyGenerate(p *plugin.Plugin, host string, basePath string) (*swaggerObje
func renderServiceRoutes(service spec.Service, groups []spec.Group, paths swaggerPathsObject, requestResponseRefs refMap) { func renderServiceRoutes(service spec.Service, groups []spec.Group, paths swaggerPathsObject, requestResponseRefs refMap) {
for _, group := range groups { for _, group := range groups {
for _, route := range group.Routes { for _, route := range group.Routes {
path := group.GetAnnotation("prefix") + route.Path path := group.GetAnnotation("prefix") + route.Path
if path[0] != '/' {
path = "/" + path
}
parameters := swaggerParametersObject{} parameters := swaggerParametersObject{}
if countParams(path) > 0 { if countParams(path) > 0 {