Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/codeasashu/react-openapi-designer

A React based UI toolkit to develop openapi schema
https://github.com/codeasashu/react-openapi-designer

openapi react

Last synced: 6 days ago
JSON representation

A React based UI toolkit to develop openapi schema

Awesome Lists containing this project

README

        

# React openapi designer

React openapi designer is a react based openapi designer that conforms to [Openapi specifications](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md)

## Live Preview

To quickly get started, you can go to [https://codeasashu.github.io/react-openapi-designer/](https://codeasashu.github.io/react-openapi-designer/)

You can create a new openapi spec from scratch, or you can just paste any
existing yaml to import the spec and edit from the UI.

## Hosting

You can also build and host the repo as a static website. To do so, first build
the project.

```sh
npm run build
```

This will put the compiled files in `dist/` directory. Upload everything in that
directory to a static hosting.

## Usage options

You can pass several options to the target HTML div.

#### Listening to spec changes

You can listen to changes in the openapi spec and take actions on it

```html


window.onload = function () {
var doc = document.getElementById("abcdef")
doc.addEventListener("specChanged", function (e) {
e.data.text().then((s) => {
const spec = JSON.parse(s);
console.log("spec in yaml syntax", spec.yaml)
console.log("spec in json syntax", spec.json)
})
})
}

```

#### Adding mock url

Adding a external url for host mocking for the spec, will show up as a
mock url in the `Samples` widget.

```html

```

## Local development

To start local development, clone this repo.

```sh
git clone https://github.com/codeasashu/react-openapi-designer
```

Then, install npm modules

```sh
npm install
```

and finally start dev server:

```sh
npm run dev
```