From 6b206b610842f58bceef5fb97af7af2a60014f3e Mon Sep 17 00:00:00 2001 From: jaron Date: Tue, 3 Dec 2024 11:09:44 +0800 Subject: [PATCH] fix(gen): fix route2Code --- internal/gen/genapi/routes.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/gen/genapi/routes.go b/internal/gen/genapi/routes.go index 14c4b625..f707f061 100644 --- a/internal/gen/genapi/routes.go +++ b/internal/gen/genapi/routes.go @@ -80,10 +80,14 @@ func (ja *JzeroApi) genRoute2Code() ([]byte, error) { for _, s := range ja.ApiSpecMap { for _, g := range s.Service.Groups { for _, r := range g.Routes { - routes = append(routes, Route{ + route := Route{ Group: g.GetAnnotation("group"), Route: r, - }) + } + if g.GetAnnotation("prefix") != "" { + route.Path = g.GetAnnotation("prefix") + r.Path + } + routes = append(routes, route) } } }