Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@signalwire-community/docusaurus-preset-openapi

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signalwire-community/docusaurus-preset-openapi

OpenAPI preset for Docusaurus.

  • 0.6.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Docusaurus OpenAPI

OpenAPI plugin for generating API reference docs in Docusaurus v2.

Installation

Install the preset in your docusaurus project by running:

// with npm
npm install docusaurus-preset-openapi

// with yarn
yarn add docusaurus-preset-openapi

Usage

  1. Add your OpenAPI definition to the root of your site dir as openapi.json (See Configuration options below).

  2. The OpenAPI preset can be used as a drop-in replacement for @docusaurus/preset-classic, replace it as follows:

    /* docusaurus.config.js */
    
    {
      presets: [
        [
          "docusaurus-preset-openapi",
          {
            // docs: { ... },
            // blogs: { ... },
            // theme: { ... },
          },
        ],
      ],
    }
    
  3. Add a link to the API section of your site by updating themeConfig.navbar.items:

    /* docusaurus.config.js */
    
    {
      themeConfig: {
        navbar: {
          items: [
            // ... other items
            { to: "/api", label: "API", position: "left" },
            // ... other items
          ],
        },
      },
    }
    

Configuration

The OpenAPI plugin can be configured with the following options:

NameTypeDefaultDescription
pathstring'openapi.json'Path to OpenAPI definition (json or yaml) on filesystem relative to site dir.
routeBasePathstring'api'URL route for the API section of your site. DO NOT include a trailing slash. Use / for shipping API without base path.
sidebarCollapsiblebooleantrueWhether sidebar categories are collapsible by default.
sidebarCollapsedbooleantrueWhether sidebar categories are collapsed by default.
apiLayoutComponentstring'@theme/ApiPage'Root Layout component of each API page.
apiItemComponentstring'@theme/ApiItem'Main API container, with demo panel, pagination, etc.
remarkPluginsany[][]Remark plugins passed to MDX.
rehypePluginsany[][]Rehype plugins passed to MDX.
beforeDefaultRemarkPluginsany[][]Custom Remark plugins passed to MDX before the default Docusaurus Remark plugins.
beforeDefaultRehypePluginsany[][]Custom Rehype plugins passed to MDX before the default Docusaurus Rehype plugins.

Example:

/* docusaurus.config.js */

{
  presets: [
    [
      "docusaurus-preset-openapi",
      {
        api: {
          path: "api/cars.yaml",
          routeBasePath: "cars",
          // ... other options
        }
      },
    ],
  ],
}

Keywords

FAQs

Package last updated on 24 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc