Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/temando/remark-openapi
Remark plugin that converts a link to a local or remote OpenAPI spec into a table with summary of all paths
https://github.com/temando/remark-openapi
openapi remark remark-plugin
Last synced: 7 days ago
JSON representation
Remark plugin that converts a link to a local or remote OpenAPI spec into a table with summary of all paths
- Host: GitHub
- URL: https://github.com/temando/remark-openapi
- Owner: temando
- License: mit
- Created: 2017-08-18T04:09:40.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-18T04:52:53.000Z (about 7 years ago)
- Last Synced: 2024-04-26T07:41:18.470Z (7 months ago)
- Topics: openapi, remark, remark-plugin
- Language: JavaScript
- Homepage:
- Size: 43 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# remark-openapi
[![NPM](https://img.shields.io/npm/v/remark-openapi.svg)](https://npmjs.org/packages/remark-openapi/)
[![Travis CI](https://img.shields.io/travis/temando/remark-openapi.svg)](https://travis-ci.org/temando/remark-openapi)
[![MIT License](https://img.shields.io/github/license/temando/remark-openapi.svg)](https://en.wikipedia.org/wiki/MIT_License)A [remark](https://github.com/wooorm/remark) plugin that converts a link to a local or remote open api spec into a table with summary of all paths.
This project is inspired by [remark-swagger](https://github.com/yoshuawuyts/remark-swagger). It borrows some code in table generation from [remark-swagger](https://github.com/yoshuawuyts/remark-swagger).
## Installation
```sh
$ npm install remark-openapi
```## Usage
This plugin is to be used with [remark](https://github.com/wooorm/remark), e.g.
```js
var vfile = require('to-vfile');
var remark = require('remark');
var openapi = require('remark-openapi');var example = vfile.readSync('example.md');
remark()
.use(openapi)
.process(example, function (err, file) {
if (err) throw err;console.log(String(file));
});
```This plugin does a conversion when the markdown file contains a link to a local open api spec file
```md
[API Reference](../assets/petstore-open-api.json "openapi:")
```or a remote open api spec file
```md
[API Reference](https://temando.github.io/open-api-renderer/petstore-open-api-v3.0.0-RC2.json "openapi:")
```The above will be converted to the following table:
```md
# swagger link
| Path | Method | Summary |
| ----- | ------ | -------------------------- |
| /pet | POST | Add a new pet to the store |
| /pet | PUT | Update an existing pet |
| /user | POST | Create user |
```