# swag

> Generates Swagger 2.0 API documentation from annotations in Go code

Source: https://talira.ai/catalog/swag-zztj4s6t
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool, Library
- Categories: [developer tools / api / documentation](https://talira.ai/categories/developer-tools/api/documentation)
- Licence: MIT[^4]
- Pricing: Free and open source[^3]
- Free tier: yes[^3]
- Backed by: [Swaggo](https://talira.ai/orgs/swaggo.md)

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.

## Links

- GitHub: https://github.com/swaggo/swag

## Ways to install

### Package managers

- [Homebrew](https://talira.ai/catalog/homebrew-djy17yn9.md): <https://formulae.brew.sh/formula/swag>[^1]
- [mise](https://talira.ai/catalog/mise-0axr08xw.md): <https://mise-versions.jdx.dev/tools/swag>[^2]

## 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

## Trust

Overall: 0.54 out of 1.
Signals: maintenance 0.48, adoption 0.82, momentum 0.62, community 0.97, backing 0.30, extensibility 0.00.

- last commit 2 months ago
- 5 commits in the last 90 days
- latest release v2.0.0-rc6 2 months ago
- 13.0k GitHub stars
- 270 contributors
- 31 Homebrew installs in 30 days
- backed by Swaggo

## Sources

[^1]: https://formulae.brew.sh/api/formula/swag.json (checked 30 Nov 2026)
[^2]: https://mise-versions.jdx.dev/tools.json (checked 30 Nov 2026)
[^3]: https://github.com/swaggo/swag/blob/master/README.md (checked 30 Nov 2026)
[^4]: https://github.com/swaggo/swag/blob/master/license (checked 30 Nov 2026)
