{"repo":"swaggo/swag","free":true,"listed":false,"github":"https://github.com/swaggo/swag","clone":"git clone https://github.com/swaggo/swag.git","description":"Automatically generate RESTful API documentation with Swagger 2.0 for Go.","language":"Go","stars":12982,"topics":["golang","swagger","swagger2","annotations","openapi"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"swag 🌍 English ∙ 简体中文 ∙ Português Swag converts Go annotations to Swagger Documentation 2.0. We've created a variety of plugins for popular Go web frameworks. This allows you to quickly integrate with an existing Go project (using Swagger UI). Contents - Getting started - Supported Web Frameworks - How to use it with Gin - The swag formatter - Implementation Status - Declarative Comments Format - General API Info - API Operation - Security - Examples - Descriptions over multiple lines - User defined structure with an array type - Function scoped struct declaration - Model composition in response - Add request headers - Add response headers - Use multiple path params - Example value of struct - SchemaExample of body - Description of struct - Use swaggertype tag to supported custom type - Use global overrides to support a custom type - Use swaggerignore tag to exclude a field - Add extension info to struct field - Rename model to display - How to use security annotations - Add a description for enum items - Generate only specific docs file types - How to use Go generic types - About the Project Getting started 1. Add comments to your API source code, See Declarative Comments Format. 2. Install swag by using: To build from source you need Go (1.19 or newer). Alternatively you can run the docker image: Or download a pre-compiled binary from the release page. 3. Run swag init in the project's root folder which contains the main.go file. This will parse your comments and generate ","default_branch":null,"files":null,"tree":[],"storefront":"/r/swaggo","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/swaggo/swag/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}