{"repo":"swaggo/http-swagger","free":true,"listed":false,"github":"https://github.com/swaggo/http-swagger","clone":"git clone https://github.com/swaggo/http-swagger.git","description":"Default net/http wrapper to automatically generate RESTful API documentation with Swagger 2.0.","language":"Go","stars":579,"topics":["golang","swagger2","middleware"],"license":"MIT","category":"dev-tools","readme_excerpt":"http-swagger Default net/http wrapper to automatically generate RESTful API documentation with Swagger 2.0. Usage V2 require go 1.16 or higher due to the use of embed package. Start using it 1. Add comments to your API source code, See Declarative Comments Format. 2. Download Swag for Go by using: To build from source you need Go (1.17 or newer). Or download a pre-compiled binary from the release page. 3. Run the Swag in your Go project root folder which contains main.go file, Swag will parse comments and generate required files( docs folder and docs/doc.go ). 4. Download http-swagger by using: And import following in your code: Canonical example: 5. Run it, and browser to http://localhost:1323/swagger/index.html, you can see Swagger 2.0 Api documents. Optional configuration As documented here, you can customize SwaggerUI with options and plugins. This package supports that customization with the Plugins and UIConfig options. These may be set to generate plugin lines and configuration parameters in the generated SwaggerUI JavaScript. In addition, BeforeScript and AfterScript options may be used to generate JavaScript before and after SwaggerUIBundle creation, respectively. BeforeScript may be used to declare a plugin, for example, and AfterScript may be used to run a block of JavaScript on page load. A trivial example To illustrate these options, take the following code: When you then open Swagger UI and inspect the source JavaScript, you would see the following: A practical ","default_branch":null,"files":null,"tree":[],"storefront":"/r/swaggo","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/swaggo/http-swagger/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."}