• Stars
    star
    493
  • Rank 89,306 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿฆ• OpenAPI plugin for generating API reference docs in Docusaurus v2.

Docusaurus OpenAPI (beta)

OpenAPI plugin for generating API reference docs in Docusaurus v2.

license npm latest package npm downloads build
prettier Cypress.io jest PRs Welcome

Quick Overview

npx create-docusaurus-openapi my-website
cd my-website
npm start

Coming from v0.1.0? See the migration guide.

(npx comes with npm 5.2+ and higher)

Then open http://localhost:3000/ to see your site.
When youโ€™re ready to deploy to production, create a minified bundle with npm run build.

Creating a new Site

Youโ€™ll need to have Node 14.0.0 or later version on your local development machine (but itโ€™s not required on the server). We recommend using the latest LTS version. You can use nvm (macOS/Linux) or nvm-windows to switch Node versions between different projects.

To create a new site, you may choose one of the following methods:

  • npx

    npx create-docusaurus-openapi my-website

    (npx is a package runner tool that comes with npm 5.2+ and higher)

  • npm

    npm init docusaurus-openapi my-website

    npm init <initializer> is available in npm 6+

  • yarn

    yarn create docusaurus-openapi my-website

    yarn create <starter-kit-package> is available in Yarn 0.25+

It will create a directory called my-website inside the current folder.
Inside that directory, it will generate the initial project structure and install the transitive dependencies:

my-website
โ”œโ”€โ”€ blog
โ”‚   โ”œโ”€โ”€ 2019-05-28-hola.md
โ”‚   โ”œโ”€โ”€ 2019-05-29-hello-world.md
โ”‚   โ””โ”€โ”€ 2020-05-30-welcome.md
โ”œโ”€โ”€ docs
โ”‚   โ”œโ”€โ”€ doc1.md
โ”‚   โ”œโ”€โ”€ doc2.md
โ”‚   โ”œโ”€โ”€ doc3.md
โ”‚   โ””โ”€โ”€ mdx.md
โ”œโ”€โ”€ src
โ”‚   โ”œโ”€โ”€ css
โ”‚   โ”‚   โ””โ”€โ”€ custom.css
โ”‚   โ””โ”€โ”€ pages
โ”‚       โ”œโ”€โ”€ styles.module.css
โ”‚       โ””โ”€โ”€ index.js
โ”œโ”€โ”€ static
โ”‚   โ””โ”€โ”€ img
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ openapi.json
โ”œโ”€โ”€ docusaurus.config.js
โ”œโ”€โ”€ babel.config.js
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ sidebars.js
โ””โ”€โ”€ README.md
  • /docusaurus.config.js - A config file containing the site configuration. This can be used to configure the OpenAPI preset
  • /openapi.json - The default OpenAPI definition that will be served (path can be configured in docusaurus.config.js).

For more info see project structure rundown.

Once the installation is done, you can open your project folder:

cd my-website

Inside the newly created project, you can run some built-in commands:

npm start or yarn start

Runs the site in development mode.
Open http://localhost:3000 to view it in the browser.

The page will automatically reload if you make changes to the code.

npm run build or yarn build

Builds the site for production to the build folder.

Docusaurus is a modern static website generator that will build the website into a directory of static contents, which can be copied to any static file hosting service like GitHub pages, Vercel or Netlify.

Add to an existing Site

  1. Install the dependency

    npm install docusaurus-preset-openapi
  2. Edit your docusaurus.config.js file to use this preset

    presets: [
      [
        "docusaurus-preset-openapi",
        /** @type {import('docusaurus-preset-openapi').Options} */
        {
          api: {
            path: "<PATH_TO_YOUR_OPENAPI_DOCUMENT>",
            routeBasePath: "/api",
          },
          docs: {
            sidebarPath: require.resolve("./sidebars.js"),
            routeBasePath: "/",
          },
          theme: {
            customCss: require.resolve("./src/css/custom.css"),
          },
        },
      ],
    ];

Popular Alternatives

Docusaurus OpenAPI is great for:

  • Static generation All OpenAPI operations will be rendered as static pages at build time, giving many performance benefits.
  • Demo panel Allow users to try out your API with an interactive demo panel.
  • Native Docusaurus feel Built from scratch to work with Docusaurus.

Here are a few common cases where you might want to try something else:

  • If you need better support for more advanced OpenAPI features, check out Redocusaurus. Redocusaurus embeds the much more mature OpenAPI documentation generator, Redoc, into Docusaurus as a React component.

Contributing

We encourage you to contribute to Docusaurus OpenAPI! Please check out the Contributing to Docusaurus OpenAPI guide for guidelines about how to proceed.

License

Docusaurus OpenAPI is released under the MIT License.

More Repositories

1

cloud-annotations

๐Ÿ A fast, easy and collaborative open source image annotation tool for teams and individuals.
TypeScript
2,677
star
2

object-detection-react

โš›๏ธ Real-Time Custom Object Detection with TensorFlow.js
JavaScript
254
star
3

object-tracking-js

Track an object as it moves in a video with no training
JavaScript
187
star
4

object-detection-ios

๐Ÿ“ฑ Real-Time Custom Object Detection with Core ML
Swift
54
star
5

iris

Source for the Cloud Annotations tool
JavaScript
44
star
6

object-detection-android

๐Ÿ“ฑ Custom Object Detection with TensorFlow Lite (not Real-Time)
Java
37
star
7

javascript-sdk

Use custom trained Cloud Annotations models with TensorFlow.js
TypeScript
24
star
8

object-detection-live-stream

๐Ÿ”ด Real-Time Object Detection on a Livestream with TensorFlow.js
HTML
15
star
9

object-detection-python

๐Ÿ Run Object Detection Inferences in Python
12
star
10

custom-training

๐Ÿ‘ทโ€โ™€๏ธ Build and train your own model
Python
11
star
11

classification-react

CSS
11
star
12

classification-ios

๐Ÿ“ฑ Run Classification Inferences in iOS
Swift
8
star
13

classification-android

๐Ÿ“ฑ Run Classification Inferences in Android
Java
7
star
14

google-colab-training

A notebook for training an object detection model
Jupyter Notebook
5
star
15

raspberrypi-streaming-object-detection

JavaScript
5
star
16

classification-python

๐Ÿ Run Classification Inferences in Python
2
star
17

node-red-contrib-cloud-annotations

Node-RED nodes for making predictions with Cloud Annotations models
HTML
2
star
18

workshop-template

A template for a GitHub pages workshop stepper UI
CSS
2
star
19

ip-camera-object-detection

HTML
1
star
20

standalone-video-react

A react app ready for standalone videos with tensorflow.js models
JavaScript
1
star
21

elyra

Jupyter Notebook
1
star
22

hooks-test

1
star
23

node-red-contrib-cloud-annotations-gpu

HTML
1
star
24

elyra-classification-training

Jupyter Notebook
1
star