swaggo: Automatically generate RESTful API documentation with Swagger 2.0 for Go.
// TODO: To be updated…
目录
待更新
1. 快速开始
下载swaggo
:
> go get -u github.com/swaggo/swag/cmd/swag
2. swag cli
> swag init -h
NAME:
swag init - Create docs.go
USAGE:
swag init [command options] [arguments...]
OPTIONS:
--generalInfo value, -g value Go file path in which 'swagger general API Info' is written (default: "main.go")
--dir value, -d value Directory you want to parse (default: "./")
--propertyStrategy value, -p value Property Naming Strategy like snakecase,camelcase,pascalcase (default: "camelcase")
--output value, -o value Output directory for all the generated files(swagger.json, swagger.yaml and doc.go) (default: "./docs")
--parseVendor Parse go files in 'vendor' folder, disabled by default
--parseDependency Parse go files in outside dependency folder, disabled by default
// TODO: To be updated…
参考文章
Github 项目
Gin & RESTful API
swaggo 教程
doc.json 重定向至 about:blank
validator 结构字段验证
binding 请求绑定
- BindJSON validation failed for a required integer field that has zero value - gin | Github
- bug:c.BindJSON(&req) - gin | Github
- Binding JSON having fields with empty string generates validation error - gin | Github
- Binding failed on int required field when value is 0 - gin | Github
- Bind validation bug with int zero value - gin | Github
- 模型绑定和验证 | Gin Web Framework
- Model binding and validation - gin-gonic/gin | Github