Generates Swagger 2.0 API documentation from annotations in Go code
open sourceMITfree
swag converts declarative comments in Go code into Swagger 2.0 API documentation. You annotate your handlers with general API info, operations, parameters, responses and security, run the swag CLI to generate the spec, and serve it through plugins for popular Go web frameworks such as Gin, Echo, Buffalo, net/http, gorilla/mux, chi, Flamingo and Fiber. It also includes a formatter for the annotations. It installs with go install github.com/swaggo/swag/cmd/swag@latest and is MIT licensed.
Ways to install
Package managers
Problems it solves
- I want Swagger docs for my Go Gin API generated from comments
- I need to keep my Go REST API documentation in sync with the code
- I want a Swagger UI for my Echo or Fiber service
Features
- Swagger 2.0 docs from Go annotations
- CLI that generates the spec
- Plugins for Gin, Echo, Buffalo, net/http, chi, Fiber and more
- Annotation formatter
