paint-brush
Generate beautiful Swagger API documentation from Insomniaby@mlabouardy
24,422 reads
24,422 reads

Generate beautiful Swagger API documentation from Insomnia

by Mohamed Labouardy
Mohamed Labouardy HackerNoon profile picture

Mohamed Labouardy

@mlabouardy

DevOps Engineer

November 3rd, 2017
Read on Terminal Reader
Read this story in a terminal
Print this story
Read this story w/o Javascript
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

I recently built a tool called <a href="https://github.com/mlabouardy/swaggymnia" target="_blank"><strong>Swaggymnia</strong></a> to generate <a href="https://swagger.io/" target="_blank">Swagger</a> documentation for an existing API in <a href="https://insomnia.rest/" target="_blank">Insomnia </a>REST client. So brace yourself for a short but interesting quick tip read.
featured image - Generate beautiful Swagger API documentation from Insomnia
1x
Read by Dr. One voice-avatar

Listen to this story

Mohamed Labouardy HackerNoon profile picture
Mohamed Labouardy

Mohamed Labouardy

@mlabouardy

DevOps Engineer

I recently built a tool called Swaggymnia to generate Swagger documentation for an existing API in Insomnia REST client. So brace yourself for a short but interesting quick tip read.

Start by downloading Swaggymnia, find the appropriate package for your system and download it. For linux:

wget https://s3.amazonaws.com/swaggymnia/1.0.0-beta/linux/swaggymnia

After downloading Swaggymnia. Add the execution permission to the binary:

chmod +x swaggymnia

image

Note: For Windows make sure that swaggymnia binary is available on the PATH. This page contains instructions for setting the PATH on Windows.

After installing, verify the installation worked, by opening a new terminal session and checking if swaggymnia is available :

image

Once done, export your API from Insomnia:

image

Next, create a configuration file with the format below:

image

Then, issue the following command:

swaggymnia generate -i watchnow.json -c config.json -o yaml

As result, you should see a new file called swagger.yml generated:

image

Now our Swagger spec is generated, you can publish your Swagger spec as customer-facing documentation.

image

For this purpose you can use Swagger UI, which converts your Swagger spec into a beautiful, interactive API documentation.

You can download Swagger UI from here. It is just a bundle of HTML, CSS and JS files, which doesn’t require a framework or anything, so they can be installed in a directory on any HTTP server.

Once you have downloaded it, you put your swagger.yaml file into the dist directory — and open index.html and change it to point at your swagger file instead of http://petstore.swagger.io/v2/swagger.json.

Then you can open index.html in your browser, and see your new beautiful, interactive API documentation:

image

L O A D I N G
. . . comments & more!

About Author

Mohamed Labouardy HackerNoon profile picture
Mohamed Labouardy@mlabouardy
DevOps Engineer

TOPICS

THIS ARTICLE WAS FEATURED IN...

Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Pressrush
Email-database
X REMOVE AD