beego / bee

Bee is a tool for helping develop with beego app framework.
Apache License 2.0
1.45k stars 922 forks source link

生成的swagger中curl没有当前项目的context #623

Open qizhelongdeyang opened 5 years ago

qizhelongdeyang commented 5 years ago

在router中添加了一个root context path: ns := beego.NewNamespace( "/" + demo_project , beego.NSNamespace("/user", beego.NSInclude( &controllers.UserController{}, ), ), )

使用bee run -gendoc=true -downdoc=true成功生成了swagger文档,但是点击try it out按钮测试的时候curl的命令是curl -X POST "http://localhost:8080/user/login" -H "accept: application/json" -H "content-type: application/x-www-form-urlencoded" ,没有当前context path :demo_project

guhan121 commented 4 years ago

bee generate docs 是读文件和分析文件,你这个demo_project是个变量吧,怎么解析都不会对的。

ns := beego.NewNamespace( "/demo_project" ,
beego.NSNamespace("/user",
beego.NSInclude(
&controllers.UserController{},
),
),
)

这样才对

qizhelongdeyang commented 4 years ago

@guhan121 你说的对,但是目前我是想根据配置把这个demo_project作为可配置的变量,配置到config.ini中去