1
0
mirror of https://github.com/beego/bee.git synced 2024-12-22 20:20:49 +00:00

Use first NewNamespace prefix as swagger BasePath

This commit is contained in:
tnextday 2016-08-18 23:31:09 +08:00
parent 1e247452ff
commit b160eb35b5

View File

@ -108,8 +108,13 @@ func generateDocs(curpath string) {
for _, l := range stmt.Rhs {
if v, ok := l.(*ast.CallExpr); ok {
// analisys NewNamespace, it will return version and the subfunction
if selName := v.Fun.(*ast.SelectorExpr).Sel.String(); selName != "NewNamespace" {
continue
}
version, params := analisysNewNamespace(v)
rootapi.BasePath = version
if rootapi.BasePath == "" && version != "" {
rootapi.BasePath = version
}
for _, p := range params {
switch pp := p.(type) {
case *ast.CallExpr: