mirror of
https://github.com/beego/bee.git
synced 2024-11-22 15:10:54 +00:00
make docs works when EnableDocs = false
This commit is contained in:
parent
6c98bdfbbc
commit
f50dce1d52
32
g_docs.go
32
g_docs.go
@ -55,22 +55,24 @@ var rootapi swagger.ResourceListing
|
|||||||
var apilist map[string]*swagger.ApiDeclaration
|
var apilist map[string]*swagger.ApiDeclaration
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
err := json.Unmarshal([]byte(Rootinfo), &rootapi)
|
if beego.EnableDocs {
|
||||||
if err != nil {
|
err := json.Unmarshal([]byte(Rootinfo), &rootapi)
|
||||||
beego.Error(err)
|
if err != nil {
|
||||||
}
|
beego.Error(err)
|
||||||
err = json.Unmarshal([]byte(Subapi), &apilist)
|
}
|
||||||
if err != nil {
|
err = json.Unmarshal([]byte(Subapi), &apilist)
|
||||||
beego.Error(err)
|
if err != nil {
|
||||||
}
|
beego.Error(err)
|
||||||
beego.GlobalDocApi["Root"] = rootapi
|
}
|
||||||
for k, v := range apilist {
|
beego.GlobalDocApi["Root"] = rootapi
|
||||||
for i, a := range v.Apis {
|
for k, v := range apilist {
|
||||||
a.Path = urlReplace(k + a.Path)
|
for i, a := range v.Apis {
|
||||||
v.Apis[i] = a
|
a.Path = urlReplace(k + a.Path)
|
||||||
|
v.Apis[i] = a
|
||||||
|
}
|
||||||
|
v.BasePath = BasePath
|
||||||
|
beego.GlobalDocApi[strings.Trim(k, "/")] = v
|
||||||
}
|
}
|
||||||
v.BasePath = BasePath
|
|
||||||
beego.GlobalDocApi[strings.Trim(k, "/")] = v
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user