How to generate a static html file from a swagger documentation?

k0pernikus picture k0pernikus · Nov 3, 2016 · Viewed 19.3k times · Source

I have created a Swagger documentation with a yaml file under:

api/swagger/swagger.yaml

Now I want to share a static HTML document with its definition, yet it was stated on the swagger project, that they don't plan to support HTML generation at all.

How can I generate a static HTML file from a Swagger project?

Answer

William Cheng picture William Cheng · Nov 4, 2016

The easiest way I can think of is to use Swagger Editor:

  1. Go to: https://editor.swagger.io
  2. Click on "File" in the top menu bar and then select "Import File"
  3. After import, click on "Generate Client" in the top menu bar, and then select "HTML" or "HTML2" to generate static HTML documentation

editor.swagger.io uses generator.swagger.io to generate API clients, server stubs and documentation, and generator.swagger.io is powered by the open-source project Swagger Codegen.