go gin-swagger:swag init error

在go的的项目中使用`gin swagger`生成文档

在安装好3个包之后

在接口上写好注解

 

 

使用 swag init命令生成文档报错:ParseComment error in file routers/api/user.go :can not find schema type: "api.json"

 

原因:@Success和@Failure注解最后的json应该改为go自带的数据类型,或者是用户定义的类型,我修改为我上面定义的User,其他包下要带上路径后就正确的生成了文档。

 

 

 

 

 

posted @ 2019-10-24 17:39  南瓜焖饭  阅读(6045)  评论(0)    收藏  举报