swagger-md
Converts Swagger API spec to Markdown format.
Usage
Install NPM module:
npm install swagger-md
Convert Swagger API spec to Markdown format:
;; { return '```json' '{ "foo": 1 }' '```' ;} swagger_md;
// It is also possible to pass a path to the root file of the API spec (can be json or yaml) and supports local file refs.const path_to_spec = 'path/to/api-spec.json'; swagger_md;
resolveApiSpec
resolves the API spec in the same way as convertToMarkdown
but returns the resolved object without converting it to markdown
const path_to_spec = 'path/to/api-spec.json';const options = // optionally specify that external refs should be fetched and resolved external: true; swagger_md;
To use the swagger-md in a CommonJS module environment the usage statement should look like:
var swagger_md = default;...
What can it do?
See ./test-fixtures/swagger
for examples of a swagger.json
converted to Markdown.
Want it do handle more? Feel free to contribute!
Contributing
- Write a new test with new fixtures or extend the existing ones
- Make a PR
- 🙏 👏