0.0.34 • Published 3 years ago
openapi-react v0.0.34
openapi-react
A better swagger 2.0 document than swagger-ui and redoc ! (openapi spec support is coming soon! )
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
3 years ago
0.0.32
3 years ago
0.0.33
3 years ago
0.0.34
3 years ago
0.0.30
4 years ago
0.0.27
4 years ago
0.0.28
4 years ago
0.0.29
4 years ago
0.0.26
5 years ago
0.0.25
5 years ago
0.0.24
5 years ago
0.0.23
5 years ago
0.0.22
5 years ago
0.0.21
5 years ago
0.0.20
5 years ago
0.0.19
5 years ago
0.0.18
5 years ago
0.0.17
5 years ago
0.0.15
5 years ago
0.0.16
5 years ago
0.0.11
5 years ago
0.0.12
5 years ago
0.0.14
5 years ago
0.0.10
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.1
5 years ago
1.0.0
5 years ago