使用方式:
$ gf swagger -hUSAGEgf swagger [OPTION]OPTION-s, --server start a swagger server at specified address after swagger filesproduced-o, --output the output directory for storage parsed swagger files,the default output directory is "./swagger"-/--pack auto parses and packs swagger into packed/swagger.go.EXAMPLESgf swaggergf swagger --packgf swagger -s 8080gf swagger -s 127.0.0.1:8080gf swagger -o ./document/swaggerDESCRIPTIONThe "swagger" command parses the current project and produces swagger API descriptionfiles, which can be used in swagger API server. If used with "-s/--server" option, itwatches the changes of go files of current project and reproduces the swagger files,which is quite convenient for local API development.If it fails in command "swag", please firstly check your system PATH whether containinggo binary path, or you can install the "swag" tool manually referring to:https://github.com/swaggo/swag
该命令内部使用的是swag工具,相关语法请参考:https://github.com/swaggo/swag
此外,推荐使用gf框架的swagger插件,仓库地址:https://github.com/gogf/swagger
使用示例:
$ gf swagger --pack2020-12-31 00:42:10.345 producing swagger files...2020-12-31 00:42:10.452 done!2020-12-31 00:42:10.452 gf pack swagger packed/swagger.go -n packedpath 'packed/swagger.go' is not empty, files might be overwrote, continue? [y/n]: y2020-12-31 00:42:13.954 done!
