Converting Swagger specification JSON to HTML documentation

Salil picture Salil · Sep 12, 2014 · Viewed 129.5k times · Source

For some REST APIs written in PHP, I was asked to create Swagger documentation, and since I was not aware of any easy way of adding annotations to those existing APIs and create such a documentation, I used this editor to generate some for now.

I saved the JSON and YAML files created using that editor, and now I need to create the final interactive Swagger documentation (this statement might sound naive and vague).

Can someone please let me know how I can convert the Swagger JSON specification file to actual Swagger documentation?

I am on the Windows platform and do not know anything about Ant/Maven.

Answer

Vikasdeep Singh picture Vikasdeep Singh · Jun 22, 2018

Try to use redoc-cli.

I was using bootprint-openapi by which I was generating a bunch of files (bundle.js, bundle.js.map, index.html, main.css and main.css.map) and then you can convert it into a single .html file using html-inline to generate a simple index.html file.

Then I found redoc-cli very easy to to use and output is really-2 awesome, a single and beautiful index.html file.

Installation:

npm install -g redoc-cli

Usage:

redoc-cli bundle -o index.html swagger.json