Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

swagger-markdown

syroegkin10.9kMIT3.0.0TypeScript support: included

Create markdown API documentation from swagger file

swagger, md, markdown

readme

swagger-markdown

npm circle ci

CLI script to turn Swagger/OpenAPI specifications into Markdown files. Supports Swagger 2.0 and OpenAPI 3.0.* formats. OpenAPI 3.1.* is not yet supported.

The version 2.0 is a breaking change. The project was rewritten in typescript. Along with addressing multiple issues, it is more strict now with the openapi version. The --force-version flag is now obsolete and will be removed in a future release.

see examples folder

Installation

npm install -g swagger-markdown

Usage

swagger-markdown [-h] [-v] -i [-o] [--skip-info]

Options:
  -h, --help      Show this help message and exit.
  -v, --version   Show program's version number and exit.
  -i , --input    Path to the swagger yaml file
  -o , --output   Path to the resulting md file
  --skip-info     Skip the title, description, version etc, whatever is in the info block.
  --force-version [Deprecated] Set the document version, ignore version provided in the yaml file. Use with caution.

Npx (requires no installation)

npx swagger-markdown -i ./basic-auth.yaml

Example

swagger-markdown -i path/to/swagger/file.yaml

By default it will create the new file within the same directory with the same name as swagger file but with .md extension. So, if swagger file is placed in project/api-doc/swagger.yaml the new file will be created as project/api-doc/swagger.md

You can also use it as a npm script in your package.json:

npm i --save-dev swagger-markdown
{
    "scripts": {
        "md-docs": "swagger-markdown -i path/to/swagger.yaml",
        //...
    }
}
npm run md-docs

changelog

3.0.0 (2025-08-09)

Bug Fixes

Features

  • add fenced code block for md string class (04ec0d0)
  • add requiest body (dd19353)
  • add security definitions trransformers (5589660)
  • linkobject: add process link function to process link objects (c1d89af)
  • process schemas (0c2707e)
  • show parameters (e3cc8d0)
  • split more v3 and v2, add responses and models to v3 (da18994)
  • update dependecny: upgrade minimal node version to 20, upgrade openapi parser (37650d0)
  • v3: extract common functions for v2 and 3 (9753b15)

BREAKING CHANGES

  • update dependecny: the minimal node version is 20

3.0.0-beta.1 (2025-08-07)

Bug Fixes

Features

  • add fenced code block for md string class (04ec0d0)
  • add requiest body (dd19353)
  • add security definitions trransformers (5589660)
  • linkobject: add process link function to process link objects (c1d89af)
  • process schemas (0c2707e)
  • show parameters (e3cc8d0)
  • split more v3 and v2, add responses and models to v3 (da18994)
  • update dependecny: upgrade minimal node version to 20, upgrade openapi parser (37650d0)
  • v3: extract common functions for v2 and 3 (9753b15)

BREAKING CHANGES

  • update dependecny: the minimal node version is 20

2.3.2 (2024-05-26)

Bug Fixes

  • package.json & package-lock.json to reduce vulnerabilities (4ee40e1)

2.3.1 (2023-11-11)

Bug Fixes

  • chore: technical release dependencies upgrade (230e6b6)

2.3.0 (2023-04-30)

Features

  • headers: show headers in the response when present (3f02648)
  • readability: improve readability by inserting horizontal lines between blocks (94f17ab)

2.2.1 (2023-04-14)

Bug Fixes

  • correct problem of broken build caused by scattered files in multiple directories (fdac96c), closes #169

2.2.0 (2023-04-14)

Features

  • schemes: display schemes if present in the path (bbf610a)

2.1.0 (2023-04-07)

Features

  • deprecated: respect deprecated flag in the path description (c3466df)
  • externaldocs: support external docs in the path (8fee911)
  • schemes: add schemes to the document (7963c18)
  • schemes: make schemes in bold (b0877c1)

2.0.1 (2023-03-07)

Bug Fixes

  • validation: add additional validations (73aeaf8), closes #198

2.0.0 (2022-12-27)

Bug Fixes

  • argparse: fix argparse to respect the recent version (2b71a91)
  • build: fix binary build (13e0051)
  • build: introduce webpack for the binary build (f94b1e0)
  • build: make it one single file so it will work as a binary (df6b03e)
  • build: retire webpack after a long serve (7b43a4f)
  • datatypes: use md class instead of direct markup (77785cb)
  • definitions: use md classes instead of direct markdown (7388984)
  • dummy: dummy commit to re-run semantic-release job (6efe709)
  • examples: fix examples table headers (5748eea)
  • examples: update examples to have nicer tables for securiry definitions (1d7435b)
  • fix export name (180485a)
  • include files with types (391dbc7)
  • instagram: fix instagram yaml specs (1a5d0c2)
  • markdownlint is in use (da46f0a)
  • pathparameters: path parameters to use md class instead of direct markup (a62a3b7)
  • paths: use md class instead of direct markup (746babb)
  • patresponses: make path responses use md class instead of direct markup (07063ac)
  • references: fix partialr dereference (f1bcc7f)
  • securitydefinitions: use md class instead of direct header hashes (7f9d373)
  • security: security to use md classes instead of direct markdown (ef886cc)
  • tables: make number of dashes to match header length (73b6182)

Code Refactoring

  • filenames: rename main files to make it expose an api in the future (44fc7fc)

Features

  • add ts-node (0b12ae3)
  • contact -> typescript (9426bc5)
  • force-version: add temporary solution for v3 documents (1160f4e)
  • make examples to typescript (856f4d4)
  • mdstring: add concat method, which allows to concatenate strings and mdstrings (764c59f)
  • mdstring: add length property (9b6f331)
  • schema: improve schema representations for an objects (e1c477d), closes #130
  • tags: group paths by tags if provided (4a38ad6), closes #188
  • typescript: turn it to ts (8d51e84)
  • version: detect document version (a1087a7)

BREAKING CHANGES

  • filenames: the main executable file has been renamed, index.js is now swagger-markdown.js. no changes if used via npx (npx swagger-markdown). may not work with browser implementations tho
  • version: It won't process document with newer syntax, it requires now to have the document version specified
  • typescript: start to rewrite code to ts so it will be maintainable

2.0.0-beta.15 (2022-12-27)

Features

  • force-version: add temporary solution for v3 documents (1160f4e)

2.0.0-beta.14 (2022-12-27)

Bug Fixes

  • instagram: fix instagram yaml specs (1a5d0c2)

2.0.0-beta.13 (2022-12-27)

Features

  • tags: group paths by tags if provided (4a38ad6), closes #188

2.0.0-beta.12 (2022-12-26)

Bug Fixes

  • build: retire webpack after a long serve (7b43a4f)

2.0.0-beta.11 (2022-12-26)

Bug Fixes

  • build: fix binary build (13e0051)

2.0.0-beta.10 (2022-12-26)

Bug Fixes

  • build: introduce webpack for the binary build (f94b1e0)

2.0.0-beta.9 (2022-12-26)

Bug Fixes

  • build: make it one single file so it will work as a binary (df6b03e)

2.0.0-beta.8 (2022-12-26)

Code Refactoring

  • filenames: rename main files to make it expose an api in the future (44fc7fc)

BREAKING CHANGES

  • filenames: the main executable file has been renamed, index.js is now swagger-markdown.js. no changes if used via npx (npx swagger-markdown). may not work with browser implementations tho

2.0.0-beta.7 (2022-12-25)

Features

  • schema: improve schema representations for an objects (e1c477d), closes #130

2.0.0-beta.6 (2022-12-25)

Bug Fixes

  • definitions: use md classes instead of direct markdown (7388984)
  • examples: update examples to have nicer tables for securiry definitions (1d7435b)
  • security: security to use md classes instead of direct markdown (ef886cc)

2.0.0-beta.5 (2022-12-24)

Bug Fixes

  • patresponses: make path responses use md class instead of direct markup (07063ac)

Features

  • mdstring: add concat method, which allows to concatenate strings and mdstrings (764c59f)

2.0.0-beta.4 (2022-12-24)

Bug Fixes

  • examples: fix examples table headers (5748eea)
  • pathparameters: path parameters to use md class instead of direct markup (a62a3b7)
  • tables: make number of dashes to match header length (73b6182)

2.0.0-beta.3 (2022-12-24)

Bug Fixes

  • dummy: dummy commit to re-run semantic-release job (6efe709)

2.0.0-beta.2 (2022-12-24)

Bug Fixes

  • datatypes: use md class instead of direct markup (77785cb)
  • paths: use md class instead of direct markup (746babb)
  • securitydefinitions: use md class instead of direct header hashes (7f9d373)

Features

  • mdstring: add length property (9b6f331)

2.0.0-beta.1 (2022-05-22)

Bug Fixes

  • argparse: fix argparse to respect the recent version (2b71a91)
  • fix export name (180485a)
  • include files with types (391dbc7)
  • markdownlint is in use (da46f0a)
  • references: fix partialr dereference (f1bcc7f)

Features

BREAKING CHANGES

  • version: It won't process document with newer syntax, it requires now to have the document version specified
  • typescript: start to rewrite code to ts so it will be maintainable

1.4.4 (2021-11-07)

Bug Fixes

  • replace map with forEach (a0f07ba)

1.4.3 (2020-10-04)

Bug Fixes

1.4.2 (2020-07-19)

Bug Fixes

  • partiallydereference: must use Object.assign as spread wont make it go through during the build (7e28af0)

1.4.1 (2020-07-19)

Bug Fixes

  • partiallyDereference: shallow copy node (c7f3564)

1.4.0 (2020-07-04)

Bug Fixes

  • escape pipe character in text (463e9ff)

Features

  • prettify narkdown documents (47e1352)

1.3.0 (2020-07-03)

Features

  • append schema example and enum values to description (766f20f)
  • show examples for path and model definitions (37d62b5)
  • use swagger-parser to resolve $refs (6dfc6cc)

1.2.0 (2019-06-24)

Features

  • resolve multiple properties with allOf (9fae4dc)

1.0.1 (2019-06-01)

Bug Fixes

1.1.6 (2019-06-01)

Bug Fixes

  • package.json to reduce vulnerabilities (422e0f0)
  • security types should handle objects (9189823)
  • definitions: avoid undefined (714c912)
  • definitions: Replace newlines with spaces in table (ad72a3b)
  • package: change gitlab plugin to github (d8e6b49)