beedoc icon indicating copy to clipboard operation
beedoc copied to clipboard

swagger doc

Open erasin opened this issue 7 years ago • 2 comments

bee run -gendoc=true -downdoc=true

出现错误

  1. 不识别时间类型 0001 Cannot find the object: time.Time

  2. 多层 NSNamespace 无法识别, 无法生成swagger API列表

	adminAPI := beego.NewNamespace("/v1/",
		 beego.NSNamespace("/admin",               <---------- 下面部分不会生成API列表
		         beego.NSNamespace("/user",
			        beego.NSInclude(&admin.UserController{}),
		         ),

修改为

	adminAPI := beego.NewNamespace("/v1/admin",
	
		         beego.NSNamespace("/user",    <---------- 第二层级可以显示
			        beego.NSInclude(&admin.UserController{}),
		         ),

erasin avatar Dec 17 '16 07:12 erasin

what's your bee version?

astaxie avatar Dec 19 '16 02:12 astaxie

______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.6.0

├── Beego     : 1.7.2
├── GoVersion : go1.7.4
├── GOOS      : darwin
├── GOARCH    : amd64
├── NumCPU    : 4
├── GOPATH    : /Users/erasin/Development/golang
├── GOROOT    : /usr/local/opt/go/libexec
├── Compiler  : gc
└── Date      : Tuesday, 27 Dec 2016

升级了 bee 1.6.2 还是一样的结果,这样就没办法 admin,site 分组处理了,只能直接在第二级别中将前缀直接写入进去。

另外一提我试着 AddNamespace /v1/admin 和 /v1/site, swagger 的 base url 仅仅对第一次 AddNamespace 时有效(这一点并不重要)。

erasin avatar Dec 27 '16 07:12 erasin