1.4.9 โ€ข Published 2 days ago

@asyncapi/react-component v1.4.9

Weekly downloads
7,010
License
Apache-2.0
Repository
github
Last release
2 days ago

All Contributors npm npm

Overview

A official React component for AsyncAPI 2.0 specification. It allows you to render the documentation of your asynchronous API provided in the AsyncAPI specification format and validate this specification. You can fully restyle the component using your own styles.

CAUTION: This package only supports AsyncAPI 2.0 specification. If you use 1.x, we recommend that you upgrade to the latest AsyncAPI version using the Node.js or Go converters.

Prerequisites

  • react (version 16.8.0 or higher)

Installation

Run this command to install the component in your project:

npm install --save @asyncapi/react-component

Check out this simple sandbox application that uses the React component:

Edit asyncapi-react-component-in-action

Using in React

Check a simple example which shows passing the inline AsyncAPI specification with custom configurations:

import * as React from "react";
import { render } from "react-dom";
import AsyncApiComponent, { ConfigInterface } from "@asyncapi/react-component";

const schema = `
asyncapi: '2.0.0'
info:
  title: Example
  version: '0.1.0'
channels:
  example-channel:
    subscribe:
      message:
        payload:
          type: object
          properties:
            exampleField:
              type: string
            exampleNumber:
              type: number
            exampleDate:
              type: string
              format: date-time
`;

const config: ConfigInterface = {
  schemaID: 'custom-spec',
  show: {
    operations: false,
    errors: false,
  },
};

const App = () => <AsyncApiComponent schema={schema} config={config} />;

render(<App />, document.getElementById("root"));

Using in other technologies

To check how to use web-component or use a component in Angular or in NextJS see:

Props

The list of props for the AsyncAPI React component includes:

  • schema: string | AsyncAPIDocument | object | FetchingSchemaInterface

    The schema property is required and contains AsyncAPI specification. Use the string type, the AsyncAPIDocument type, parsed specification as JS object from AsyncAPI Parser or the FetchingSchemaInterface object to fetch the schema from an external resource. For more information on what it contains and what it should look like, read AsyncAPI Specification.

  • config?: Partial<ConfigInterface>

    The config property is optional and contains configuration for the AsyncAPI component. For more information on the available configuration options, read the Configuration Modification document. This property is concatenated with the default configuration.

    NOTE: The Partial<T> type means that every field in the T type is optional.

Features

For a list and description of features offered by the AsyncAPI React component, see this directory.

Styles

To use default styles import them as follows:

import "@asyncapi/react-component/styles/default.css";
// or minified version
import "@asyncapi/react-component/styles/default.min.css";

Playground

This repository comes in with a Playground application. Test it to see the component in action and play with it before you use it in your application.

You can also run the Playground application locally by following this instruction from the development guide.

Modules

The @asyncapi/react-component package has 3 crafted JS modules to be used in various environments:

  • esm (ECMAScript Modules) is intended for use in a single-page applications with predefined environments like create-react-app that are capable of resolving dependencies (via Webpack, Browserify, etc). It can also be used on the server side (for tasks like Server Side Rendering) when the application is using esm.
  • cjs (CommonJS Modules) similar uses as for esm modules, but using CommonJS modules.
  • umd (Universal Module Definition) is a dependency-free module that includes everything you need to serve AsyncAPI documentation (however React and ReactDOM dependencies must be served separately) on a single-page application that can't resolve npm module dependencies or in normal HTML page. We have 2 types of minified umd bundles, with and without AsyncAPI Parser in paths:
    • @asyncapi/react-component/browser/index.js
    • @asyncapi/react-component/browser/without-parser.js

Development

For information on how to set up a development environment, write and run tests, follow the naming and architecture convention defined for the project in the Development Guide.

Contribution

If you have a feature request, add it as an issue or propose changes in a pull request (PR). If you create a feature request, use the dedicated Feature request issue template. When you create a PR, follow the contributing rules described in the CONTRIBUTING.md document.

If you have a bug to report, reproduce it in an online code editor. For example, use CodeSandbox. Attach the link to the reproduced bug to your issue. Log the bug using the Bug report template.

Credits

The project was originally developed under the Kyma project, in 2019 it was moved under AsyncAPI Initiative.

Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

1.4.9

2 days ago

1.4.8

2 days ago

1.4.7

3 days ago

1.4.6

5 days ago

1.4.5

17 days ago

1.4.4

20 days ago

1.4.3

20 days ago

1.4.2

1 month ago

1.4.1

1 month ago

1.3.8

1 month ago

1.4.0

1 month ago

1.3.7

1 month ago

1.3.6

1 month ago

1.3.5

1 month ago

1.3.4

1 month ago

1.3.3

1 month ago

1.3.2

1 month ago

1.3.1

2 months ago

1.3.0

2 months ago

1.2.26

2 months ago

1.2.24

2 months ago

1.2.25

2 months ago

1.2.23

3 months ago

1.2.21

3 months ago

1.2.22

3 months ago

1.2.20

3 months ago

1.2.19

3 months ago

1.2.16

3 months ago

1.2.17

3 months ago

1.2.14

3 months ago

1.2.15

3 months ago

1.2.18

3 months ago

1.2.13

3 months ago

1.2.12

3 months ago

1.2.10

4 months ago

1.2.11

4 months ago

1.2.9

4 months ago

1.2.8

4 months ago

1.2.7

4 months ago

1.2.6

5 months ago

1.2.5

5 months ago

1.2.4

5 months ago

1.2.3

5 months ago

1.2.0

5 months ago

1.2.2

5 months ago

1.2.1

5 months ago

1.1.0

5 months ago

1.0.0-next.54

7 months ago

1.0.0-next.53

8 months ago

1.0.0-next.52

8 months ago

1.0.0-next.49

8 months ago

1.0.0-next.51

8 months ago

1.0.0-next.50

8 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago

1.0.3

6 months ago

1.0.0-next.48

10 months ago

1.0.0-next.47

1 year ago

1.0.0-next.46

1 year ago

1.0.0-next.45

1 year ago

1.0.0-next.44

1 year ago

1.0.0-next.43

2 years ago

1.0.0-next.42

2 years ago

1.0.0-next.41

2 years ago

1.0.0-next.39

2 years ago

0.24.23

2 years ago

1.0.0-next.40

2 years ago

1.0.0-next.38

2 years ago

1.0.0-next.37

2 years ago

0.24.22

2 years ago

1.0.0-next.36

2 years ago

1.0.0-next.35

2 years ago

0.24.21

2 years ago

0.24.20

2 years ago

1.0.0-next.33

2 years ago

1.0.0-next.32

2 years ago

1.0.0-next.31

2 years ago

1.0.0-next.30

2 years ago

1.0.0-next.34

2 years ago

1.0.0-next.29

2 years ago

1.0.0-next.28

2 years ago

1.0.0-next.27

2 years ago

1.0.0-next.26

2 years ago

1.0.0-next.25

2 years ago

0.24.18

2 years ago

1.0.0-next.22

2 years ago

0.24.17

2 years ago

0.24.19

2 years ago

1.0.0-next.24

2 years ago

0.24.16

2 years ago

1.0.0-next.23

2 years ago

0.24.15

2 years ago

0.24.14

2 years ago

0.24.13

2 years ago

1.0.0-next.21

3 years ago

1.0.0-next.19

3 years ago

1.0.0-next.20

3 years ago

0.24.12

3 years ago

0.24.11

3 years ago

0.24.10

3 years ago

0.24.9

3 years ago

0.24.8

3 years ago

0.24.5

3 years ago

0.24.7

3 years ago

0.24.6

3 years ago

1.0.0-next.18

3 years ago

1.0.0-next.17

3 years ago

1.0.0-next.16

3 years ago

0.24.4

3 years ago

1.0.0-next.15

3 years ago

1.0.0-next.14

3 years ago

1.0.0-next.13

3 years ago

1.0.0-next.12

3 years ago

1.0.0-next.11

3 years ago

1.0.0-next.10

3 years ago

0.24.3

3 years ago

1.0.0-next.9

3 years ago

0.24.2

3 years ago

1.0.0-next.8

3 years ago

1.0.0-next.7

3 years ago

0.24.1

3 years ago

1.0.0-next.6

3 years ago

0.24.0

3 years ago

1.0.0-next.4

3 years ago

1.0.0-next.5

3 years ago

0.21.0-next.1

3 years ago

1.0.0-next.1

3 years ago

1.0.0-next.2

3 years ago

0.22.7

3 years ago

0.22.6

3 years ago

0.22.5

3 years ago

0.23.1

3 years ago

0.23.0

3 years ago

1.0.0-next.3

3 years ago

0.22.4

3 years ago

0.22.3

3 years ago

0.22.2

3 years ago

0.22.1

3 years ago

0.21.0

3 years ago

0.22.0

3 years ago

0.20.2

3 years ago

0.20.1

3 years ago

0.20.0

3 years ago

0.19.2

3 years ago

0.19.1

3 years ago

0.19.0

3 years ago

0.18.2

3 years ago

0.18.1

3 years ago

0.18.0

3 years ago

0.17.11

3 years ago

0.17.10

3 years ago

0.17.9

3 years ago

0.17.8

3 years ago

0.17.7

3 years ago

0.17.6

3 years ago

0.17.3

3 years ago

0.17.4

3 years ago

0.17.5

3 years ago

0.17.2

3 years ago

0.17.1

3 years ago

0.17.0

3 years ago

0.16.2

3 years ago