0.0.34 • Published 2 years ago

openapi-react v0.0.34

Weekly downloads
29
License
MIT
Repository
github
Last release
2 years ago

openapi-react

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

NPM JavaScript Style Guide

Demo

See our Demo

Install

npm install --save openapi-react

Usage

Load by url:

import { OpenApi } from 'openapi-react'

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

Load by swagger json object

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)

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

import { OpenApi } from 'openapi-react'

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

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

License

MIT © zlkca

run example

Firstly, build library:

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
0.0.31

2 years ago

0.0.32

2 years ago

0.0.33

2 years ago

0.0.34

2 years ago

0.0.30

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.29

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.22

3 years ago

0.0.21

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.14

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.1

3 years ago

1.0.0

3 years ago