👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣
This repository is not maintained anymore.
Please use the latest v2 version of
goframe
for automatic API generating and swagger UI feature.👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣👣
Provides swagger API document feature for GoFrame project.
Download and install gf cli tool: https://github.com/gogf/gf/tree/master/cmd/gf
go get -u github.com/gogf/swagger/v2
Use v1
version command gf swagger --pack
parses and produces the /swagger/swagger.json
file and packs it to /packed/swagger.go
.
You can also use
gf run main.go --swagger -y
running your codes with hot-compiled-like feature and automatically packs the swagger files into your project.
Install the swagger using as plugin:
package main
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/swagger/v2"
)
func main() {
s := g.Server()
s.Plugin(&swagger.Swagger{})
s.SetPort(8199)
s.Run()
}
Start your server and visit: http://127.0.0.1:8199/swagger
Enjoy!
As the swagger files parsed and produced by third party tool, you can get details about comment at: https://github.com/swaggo/swag .
GF swagger feature also supports configuration from file with swagger
node.
Supported configuration item names of the node please refer to the attribute names of Swagger struct:
https://godoc.org/github.com/gogf/swagger/v2