Skip to content

OpenAPI Docs

Plugin for MkDocs to generate human readable documentation from OpenAPI Documentation Version 3 (also known as Swagger documentation).

How to use

Install using pip install neoteroi-mkdocs. Configure this plugin in the MkDocs configuration file:

  - search
  - neoteroi.mkdocsoad

Configure a source in your Markdown file, for example having a swagger.json file in your docs folder:


The plugin fetches the contents from the OpenAPI Specification source, generates Markdown using essentials-openapi, then writes them in the markdown file.

This configuration is sufficient to generate HTML documentation from OpenAPI specification files. To have a better looking result, it is recommended to apply the extra configuration steps described in the next paragraph.

This plugin was designed to generate Markdown for sites that use Material for MkDocs and three extensions from PyMdown extensions. To achieve the best results, it is recommended to enable PyMdown extensions.

  • Install PyMdown extensions using pip install pymdown-extensions
  • Configure the following PyMdown markdown extensions in the MkDocs configuration file:
  - pymdownx.details
  - pymdownx.superfences
  - pymdownx.tabbed:
      alternate_style: true
  • Enable PyMdown integration this way:
  - search
  - neoteroi.mkdocsoad:
      use_pymdownx: true
  - css/mkdocsoad.css

Example result:

Example result

Soon changing...

This feature is currently shipped as plugin for MkDocs, it will be modified to be an extension for Python Markdown.

Supported sources for OpenAPI Documentation

Source Example
YAML file [OAD(./docs/swagger.yaml)]
JSON file [OAD(./docs/swagger.json)]
URL returning YAML on HTTP GET [OAD(]
URL returning JSON on HTTP GET [OAD(]

Example result

Last modified on: 2022-08-12 07:26:10