Installing and running swagger editor
Swag - This library converts Go annotations to Swagger 2.0 docs (swagger.json/swagger.yaml), which is later used by The first two commands install swag and http-swagger respectively: Run the following commands from the commandline: Our first task is to install the libraries we are dependent on. We will retain the same for this post, and build upon it byĪdding swagger-specific libraries and annotations. In our previous post on Go APIs, we used Go’s built-in net/http library in combination with Gorilla Mux for routing. To provide some comparisons between both. I will write another post on doing the same with go-swagger and try Starting point for documenting APIs in Go. However, I found Swaggo to be simple and hassle-free and can be a good Popular frameworks available for generating Swagger docs and UI (Looking at the number of stars on Github, go Swaggo and go-swagger are two of the most , and the changes are incorporated when the API doc is generated next.
![installing and running swagger editor installing and running swagger editor](https://miro.medium.com/max/323/1*2tKCzmIJSz5xCiBCWYwTWA.png)
, updating/maintaining API documentation is a breeze - the developer just has to add/tweak annotations in the code Once setup, Swagger UI provides a convenient way for consumers to explore the API and play around with it.Īlso, APIs evolve over time and the documentation should reflect the changes accordingly (The number of bugs thatĪrise due to improper(or non-existent) communication of changes to APIs is just too damn high!). Without a clear documentation of APIs, consumers are going toįind it hard to do all of the above, which leads to a serious loss in developer productivity. Building an API is only half the job ? The other half is enablingĬlients to use, explore and test the API without too much hassle. Once we have our super-cool API ready, the next step is to share it with consumers and make it easy for them to
![installing and running swagger editor installing and running swagger editor](https://res.cloudinary.com/practicaldev/image/fetch/s--sPfIon_l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/enk4ux7ty7u3ukipfjnc.png)
Setup Swagger UI for our APIs using Swaggo.
![installing and running swagger editor installing and running swagger editor](https://sw-samuraj.cz/2017/05/Swagger-editor.png)
#Installing and running swagger editor how to#
This post is intended as a follow-up, and explains how to generate swagger documentation and In a previous post - Go REST API, we saw how to build a simple Swagger UI setup for Go REST API using Swaggo Dec 1, 2019