# openapi-react

> openapi, swagger document, markdown

Latest version **0.0.34** (published 2022-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install openapi-react
pnpm add openapi-react
yarn add openapi-react
bun add openapi-react
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.34 |
| Published | 2022-04-03 |
| First published | 2020-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 4 |
| Unpacked size | 549.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | zlkca |
| Maintainers | yocompute |
| Keywords | swagger UI, openapi, redoc, swagger, restful, markdown |

## Links

- npm: https://www.npmjs.com/package/openapi-react
- Repository: https://github.com/yocompute/openapi-react
- Homepage: https://github.com/yocompute/openapi-react#readme
- Issues: https://github.com/yocompute/openapi-react/issues
- npm.io page: https://npm.io/package/openapi-react

## Dependencies (4)

- [marked](https://npm.io/package/marked.md) 4.0.12
- [@material-ui/lab](https://npm.io/package/@material-ui/lab.md) ^4.0.0-alpha.57
- [@material-ui/core](https://npm.io/package/@material-ui/core.md) ^4.11.2
- [@material-ui/icons](https://npm.io/package/@material-ui/icons.md) ^4.11.2

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 0.0.34 (latest) — 2022-04-03
- 0.0.33 — 2022-04-03
- 0.0.32 — 2022-04-03
- 0.0.31 — 2022-04-02
- 0.0.30 — 2021-02-06
- 0.0.29 — 2021-02-06
- 0.0.28 — 2021-02-06
- 0.0.27 — 2021-02-06
- 0.0.26 — 2020-12-20
- 0.0.25 — 2020-12-20
- 0.0.24 — 2020-12-19
- 0.0.23 — 2020-12-02
- 0.0.22 — 2020-12-01
- 0.0.21 — 2020-11-30
- 0.0.20 — 2020-11-29
- … 19 more at https://npm.io/package/openapi-react/versions

## README

# openapi-react

> A better swagger 2.0 document than swagger-ui and redoc ! (openapi spec support is coming soon! )

[![NPM](https://img.shields.io/npm/v/openapi-react.svg)](https://www.npmjs.com/package/openapi-react) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Demo
[See our Demo](https://zlkca.github.io/)

## Install

```bash
npm install --save openapi-react
```


## Usage

#### Load by url:
```jsx
import { OpenApi } from 'openapi-react'

function App() {
    return <OpenApi url={"https://petstore.swagger.io/v2/swagger.json"} />
}
```

#### Load by swagger json object
```jsx
import { OpenApi } from 'openapi-react'

function App() {
    return <OpenApi spec={swaggerJsonObject} />
}
```

### Support Markdown syntax for description

In your swagger.json, you can assign Markdown content to description, openapi-react will follow Markdown spec to render it.


### Add or Modify Sections (swagger tags)

```jsx
import { OpenApi } from 'openapi-react'

const tags = [{
  name: 'Overview',
  description: '### Why you need to use openapi-react\n\n\
  *Execuatable restful api\n\n\
  *Smaller size\n\n\
  *Markdown syntax support\n\n\
  *Easy to insert sections\n\n\
  '
}];

function App() {
    return <OpenApi url={"https://petstore.swagger.io/v2/swagger.json"} tags={tags}/>
}
```

### Use with theme

```jsx
import { OpenApi } from 'openapi-react'

const theme = {
  layout:{
    leftNav: {
      width: '320px'
    }
  }
}

function App() {
    return <OpenApi spec={swaggerJsonObject} theme={theme} />
}
```


## License

MIT © [zlkca](https://github.com/zlkca)



#### run example

Firstly, build library:
```bash
git clone https://github.com/yocompute/openapi-react.git
cd openapi-react
npm i
npm run build
```

Then, you can go into example folder to try the lib:
```
cd example
npm i
npm start
```

---
_Source: https://npm.io/package/openapi-react · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
