• Stars
    star
    683
  • Rank 66,158 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 2 years ago
  • Updated 23 days 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 v3.

Docusaurus OpenAPI Doc Generator

OpenAPI plugin for generating API reference docs in Docusaurus v2.



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


Overview

The docusaurus-plugin-openapi-docs package extends the Docusaurus CLI with commands for generating MDX using the OpenAPI specification as the source. The resulting MDX is fully compatible with plugin-content-docs and can be used to render beautiful reference API docs by setting docItemComponent to @theme/ApiItem, a custom component included in the docusaurus-theme-openapi-docs theme.

Key Features:

  • Compatible: Works with Swagger 2.0 and OpenAPI 3.0.
  • Fast: Convert large OpenAPI specs into MDX docs in seconds. ๐Ÿ”ฅ
  • Stylish: Based on the same Infima styling framework that powers the Docusaurus UI.
  • Capable: Supports single, multi and even micro OpenAPI specs.

Installation

Plugin:

yarn add docusaurus-plugin-openapi-docs

Theme:

yarn add docusaurus-theme-openapi-docs

Compatibility Matrix

Docusaurus OpenAPI Docs Docusaurus
1.x.x >=2.0.1 <2.3.0
2.x.x (beta) >=2.3.0

Configuring docusaurus.config.js (Plugin and theme usage)

Here is an example of properly configuring your docusaurus.config.js file for docusaurus-plugin-openapi-docs and docusaurus-theme-openapi-docs usage.

// docusaurus.config.js

{
  presets: [
    [
      "classic",
      /** @type {import('@docusaurus/preset-classic').Options} */
      ({
        docs: {
          sidebarPath: require.resolve("./sidebars.js"),
          // Please change this to your repo.
          // Remove this to remove the "edit this page" links.
          editUrl:
            "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
          docLayoutComponent: "@theme/DocPage",
          docItemComponent: "@theme/ApiItem" // Derived from docusaurus-theme-openapi-docs
        },
        blog: {
          showReadingTime: true,
          // Please change this to your repo.
          // Remove this to remove the "edit this page" links.
          editUrl:
            "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/"
        },
        theme: {
          customCss: require.resolve("./src/css/custom.css")
        }
      })
    ]
  ],

  plugins: [
    [
      'docusaurus-plugin-openapi-docs',
      {
        id: "apiDocs",
        docsPluginId: "classic",
        config: {
          petstore: { // Note: petstore key is treated as the <id> and can be used to specify an API doc instance when using CLI commands
            specPath: "examples/petstore.yaml", // Path to designated spec file
            outputDir: "api/petstore", // Output directory for generated .mdx docs
            sidebarOptions: {
              groupPathsBy: "tag",
            },
          },
          burgers: {
            specPath: "examples/food/burgers/openapi.yaml",
            outputDir: "api/food/burgers",
          }
        }
      },
    ]
  ],
  themes: ["docusaurus-theme-openapi-docs"], // Allows use of @theme/ApiItem and other components
}

Note: You may optionally configure a dedicated @docusaurus/plugin-content-docs instance for use with docusaurus-theme-openapi-docs by setting docItemComponent to @theme/ApiItem.

Plugin Configuration Options

The docusaurus-plugin-openapi-docs plugin can be configured with the following options:

Name Type Default Description
id string null A unique document id.
docsPluginId string null The ID associated with the plugin-content-docs or preset instance used to render the OpenAPI docs (e.g. "your-plugin-id", "classic", "default").

config

config can be configured with the following options:

Name Type Default Description
specPath string null Designated URL or path to the source of an OpenAPI specification file or directory of multiple OpenAPI specification files.
ouputDir string null Desired output path for generated MDX files.
proxy string null Optional: Proxy URL to prepend to base URL when performing API requests from browser.
template string null Optional: Customize MDX content with a desired template.
downloadUrl string null Optional: Designated URL for downloading OpenAPI specification. (requires info section/doc)
hideSendButton boolean null Optional: If set to true, hides the "Send API Request" button in API demo panel
showExtensions boolean null Optional: If set to true, renders operation-level vendor-extensions in description.
sidebarOptions object null Optional: Set of options for sidebar configuration. See below for a list of supported options.
version string null Optional: Version assigned to single or micro-spec API specified in specPath.
label string null Optional: Version label used when generating version selector dropdown menu.
baseUrl string null Optional: Version base URL used when generating version selector dropdown menu.
versions object null Optional: Set of options for versioning configuration. See below for a list of supported options.
markdownGenerators object null Optional: Customize MDX content with a set of options for specifying markdown generator functions. See below for a list of supported options.

sidebarOptions can be configured with the following options:

Name Type Default Description
groupPathsBy string null Organize and group sidebar slice by specified option. Note: Currently, groupPathsBy only contains support for grouping by tag.
categoryLinkSource string null Defines what source to use for rendering category link pages when grouping paths by tag.

The supported options are as follows:

tag: Sets the category link config type to generated-index and uses the tag description as the link config description.

info: Sets the category link config type to doc and renders the info section as the category link (recommended only for multi/micro-spec scenarios).

none: Does not create pages for categories, only groups that can be expanded/collapsed.
sidebarCollapsible boolean true Whether sidebar categories are collapsible by default.
sidebarCollapsed boolean true Whether sidebar categories are collapsed by default.
customProps object null Additional props for customizing a sidebar item.

You may optionally configure a sidebarOptions. In doing so, an individual sidebar.js slice with the configured options will be generated within the respective outputDir.

versions can be configured with the following options:

Name Type Default Description
specPath string null Designated URL or path to the source of an OpenAPI specification file or directory of micro OpenAPI specification files.
ouputDir string null Desired output path for versioned, generated MDX files.
label string null Optional: Version label used when generating version selector dropdown menu.
baseUrl string null Optional: Version base URL used when generating version selector dropdown menu.

All versions will automatically inherit sidebarOptions from the parent/base config.

markdownGenerators

markdownGenerators can be configured with the following options:

Name Type Default Description
createApiPageMD function null Optional: Returns a string of the raw markdown body for API pages.

Function type: (pageData: ApiPageMetadata) => string
createInfoPageMD function null Optional: Returns a string of the raw markdown body for info pages.

Function type: (pageData: InfoPageMetadata) => string
createTagPageMD function null Optional: Returns a string of the raw markdown body for tag pages.

Function type: (pageData: TagPageMetadata) => string

CLI Usage

Usage: docusaurus <command> [options]

Options:
  -V, --version                                            output the version number
  -h, --help                                               display help for command

Commands:
  build [options] [siteDir]                                Build website.
  swizzle [options] [themeName] [componentName] [siteDir]  Wraps or ejects the original theme files into website folder for customization.
  deploy [options] [siteDir]                               Deploy website to GitHub pages.
  start [options] [siteDir]                                Start the development server.
  serve [options] [siteDir]                                Serve website locally.
  clear [siteDir]                                          Remove build artifacts.
  write-translations [options] [siteDir]                   Extract required translations of your site.
  write-heading-ids [options] [siteDir] [files...]         Generate heading ids in Markdown content.
  docs:version <version>                                   Tag a new docs version
  gen-api-docs <id>                                        Generates OpenAPI docs in MDX file format and sidebar.js (if enabled).
  gen-api-docs:version <id:version>                        Generates versioned OpenAPI docs in MDX file format, versions.js and sidebar.js (if enabled).
  clean-api-docs <id>                                      Clears the generated OpenAPI docs MDX files and sidebar.js (if enabled).
  clean-api-docs:version <id:version>                      Clears the versioned, generated OpenAPI docs MDX files, versions.json and sidebar.js (if
                                                           enabled).

Generating OpenAPI Docs

To generate all OpenAPI docs, run the following command from the root directory of your project:

yarn docusaurus gen-api-docs all

This will generate API docs for all of the OpenAPI specification (OAS) files referenced in your docusaurus-plugin-openapi-docs config.

You may also generate OpenAPI docs for a single path or OAS by specifying the unique id:

yarn docusaurus gen-api-docs <id>

Example:

yarn docusaurus gen-api-docs burgers

The example above will only generate API docs relative to burgers.

Cleaning API Docs

To clean/remove all API Docs, run the following command from the root directory of your project:

yarn docusaurus clean-api-docs all

You may also remove a particular set of API docs by specifying the unique id of your desired spec instance.

yarn docusaurus clean-api-docs <id>

Example:

yarn docusaurus clean-api-docs burgers

The example above will remove all API docs relative to burgers.

Versioning OpenAPI docs

To generate all versioned OpenAPI docs, run the following command from the root directory of your project:

yarn docusaurus gen-api-docs:version <id>:all

Example:

yarn docusaurus gen-api-docs:version petstore:all

This will generate API docs for all of the OpenAPI specification (OAS) files referenced in your versions config and will also generate a versions.json file.

Substitue all with a specific version ID to generate/clean a specific version. Generating for all or a specific version ID will automatically update the versions.json file.

Installing from Template

Run the following to bootstrap a Docsaurus v2 site (classic theme) with docusaurus-openapi-docs:

npx [email protected] my-website --package-manager yarn

When prompted to select a template choose Git repository.

Template Repository URL:

https://github.com/PaloAltoNetworks/docusaurus-template-openapi-docs.git

When asked how the template repo should be cloned choose "copy" (unless you know better).

cd my-website
yarn

Developer Quick Start

Looking to make a contribution? Make sure to checkout out our contributing guide.

After forking the main repository, run the following:

git clone https://github.com/<your account>/docusaurus-openapi-docs.git
cd docusaurus-openapi-docs
yarn
yarn build-packages
yarn watch:demo

Credits

Special thanks to @bourdakos1 (Nick Bourdakos), the author of docusaurus-openapi, which this project is heavily based on.

For more insight into why we decided to completely fork see #47

Contributors

Support

See SUPPORT.md for our support agreement and guidelines.

If you believe you found a bug or have an idea you'd like to suggest you may report an issue or start a discussion.

More Repositories

1

WireLurkerDetector

Script for detecting the WireLurker malware family
Python
412
star
2

minemeld

Main MineMeld documentation repo
373
star
3

pan-os-python

The PAN-OS SDK for Python is a package to help interact with Palo Alto Networks devices (including physical and virtualized Next-generation Firewalls and Panorama). The pan-os-python SDK is object oriented and mimics the traditional interaction with the device via the GUI or CLI/API.
Python
339
star
4

rbac-police

Evaluate the RBAC permissions of Kubernetes identities through policies written in Rego
Go
280
star
5

ansible-pan

Ansible modules for Palo Alto Networks NGFWs
Python
228
star
6

pan-os-ansible

Ansible collection for easy automation of Palo Alto Networks next generation firewalls and Panorama, in both physical and virtual form factors.
Python
201
star
7

iron-skillet

IronSkillet is a set of day-one configuration templates for PAN-OS to enable alignment with security best practices. See the Quick Start section below to get started using the template configurations.
Python
200
star
8

minemeld-core

Engine of MineMeld
Python
140
star
9

terraform-templates

This repo contains Terraform templates to deploy infrastructure on AWS and Azure and to secure them using the Palo Alto Networks Next Generation Firewalls
Python
138
star
10

ansible-playbooks

Sample playbooks for the Palo Alto Networks Ansible modules.
Jinja
124
star
11

azure

VM-Series ARM Templates for Microsoft Azure
Python
101
star
12

Splunk-Apps

Palo Alto Networks App for Splunk leverages the data visibility provided by Palo Alto Networks next-generation firewalls and endpoint security with Splunk's extensive investigation and visualization capabilities to deliver an advanced security reporting and analysis tool.
Python
93
star
13

IAM-Deescalate

IAM-Deescalate helps mitigate privilege escalation risk in AWS identity and access management (IAM)
Python
89
star
14

terraform-provider-panos

Terraform Panos provider
Go
87
star
15

prisma-cloud-policies

PCS Policies Release Notice
81
star
16

prisma-cloud-docs

Prisma Cloud docs
80
star
17

aws

VM-Series for Amazon Web Services
Python
71
star
18

prisma_channel_resources

A collection of technical and sales resources related to Prisma Cloud Compute and Prisma Cloud Enterprise created for the PANW Channel Partner Ecosystem and other engineers working with the solution
Shell
66
star
19

pcs-postman

Postman collections for Prisma Cloud
60
star
20

aws-elb-autoscaling

Auto Scaling VM-Series firewalls in AWS
HTML
57
star
21

pan-os-php

Framework and utilities to easily manage and edit Palo Alto Network PANOS devices
PHP
54
star
22

terraform-provider-prismacloud

Terraform PrismaCloud provider
Go
53
star
23

Prisma-Enhanced-Remediation

Create custom auto-remediation solutions using serverless functions in the cloud.
Python
52
star
24

pango

pango is the underlying library for the Palo Alto Networks Terraform provider
Go
52
star
25

pyjarm

pyJARM is a library for doing JARM fingerprinting using python
Python
50
star
26

AWS-GWLB-VMSeries

This repository contains CFT and TF templates for deploying VM-Series Firewalls behind AWS Gateway Load Balancer
HCL
50
star
27

minemeld-ansible

Ansible playbook for installing MineMeld on Linux
Shell
48
star
28

can-ctr-escape-cve-2022-0492

Test whether a container environment is vulnerable to container escapes via CVE-2022-0492
Shell
46
star
29

prisma-cloud-scan

GitHub action to scan container images with Palo Alto Networks' Prisma Cloud
JavaScript
46
star
30

prismacloud-api-python

Prisma Cloud utility scripts, and a Python SDK for Prisma Cloud APIs.
Python
45
star
31

pan-cortex-data-lake-python

Python idiomatic SDK for Cortexโ„ข Data Lake.
Python
44
star
32

InstallerHijackingVulnerabilityScanner

Java
43
star
33

research-notes

43
star
34

terraform-azurerm-vmseries-modules

Terraform Reusable Modules for VM-Series on Azure
HCL
43
star
35

aws-transit-vpc

automated AWS transit vpc
Python
41
star
36

panhandler

Panhandler is a tool to manage config snippets and Skillets for PAN-OS devices
HTML
41
star
37

minemeld-webui

WebUI of MineMeld
TypeScript
41
star
38

pan.dev

Palo Alto Networks for Developers
MDX
39
star
39

pcs-sizing-scripts

Prisma Cloud sizing scripts
Shell
37
star
40

minemeld-node-prototypes

Prototypes for MineMeld nodes
Python
37
star
41

TransitGatewayDeployment

Creates a Transit Gateway with two server VPCs and a security VPC
Python
35
star
42

terraform-aws-vmseries-modules

Terraform Reusable Modules for VM-Series on AWS
HCL
32
star
43

Kubernetes

Repository for Palo Alto Networks Kubernetes Security - CN Series.
30
star
44

ReferenceArchitectures

Palo Alto Networks Reference Architectures
29
star
45

evident-custom-signatures

Evident Security Platform Custom Signatures Samples
Ruby
28
star
46

pan-fca

Flexible Cloud Automation
Python
28
star
47

prismacloud-cli

The Prisma Cloud CLI is a command line interface for Prisma Cloud by Palo Alto Networks.
Python
27
star
48

terraform-best-practices

A set of best practices to be followed when contributing to the Palo Alto Networks terraform modules
27
star
49

report_to_misp

Parse a report and import the events into MISP
Python
26
star
50

tg

Certificate generation made easy
Go
26
star
51

autofocus-lenz

A command line utility to aid in using autofocus for IR and research
Python
25
star
52

azure-applicationgateway

Scale out security for web deployments using VM-Series firewalls and Azure Application Gateway web load balancer
25
star
53

prisma-cloud-compute-sample-code

Example scripts, snippets, and other documents related to Prisma Cloud Compute
Open Policy Agent
25
star
54

lab-aws-gwlb-vmseries

Materials for PS Regional Training AWS lab
HCL
24
star
55

terraform-provider-prismacloudcompute

Terraform provider for Prisma Cloud Compute
Go
24
star
56

gaia

Aporeto API (Elemental model)
Go
23
star
57

cobra-tool

Cloud Offensive Breach and Risk Assessment (COBRA) Tool
Python
23
star
58

prisma.pan.dev

The home of Developer docs for Prisma by Palo Alto Networks
JavaScript
21
star
59

Azure-Transit-VNet

Azure security with VM-Series in a hub-and-spoke architecture
Python
19
star
60

pan-stix

pan-stix
Python
19
star
61

minemeld-misp

MineMeld nodes for MISP
Python
19
star
62

autofocus-client-library

A python client library for interfacing with the autofocus rest services
Python
19
star
63

openstack-templates

VM-Series Firewalls on OpenStack
Rich Text Format
19
star
64

Splunk_TA_paloalto

The Palo Alto Networks Add-on for Splunk allows a Splunkยฎ Enterprise or Splunk Cloud administrator to collect data from Palo Alto Networks Next-Generation Firewall devices and Advanced Endpoint Protection.
Python
19
star
65

azure-autoscaling

Azure autoscaling solution using VMSS
C#
17
star
66

regolithe

Regolithe Specifications + Dev Tools
Go
17
star
67

elemental

Go library implementing the Regolithe specifications as Elemental model
Go
17
star
68

tcpsession

A python library to extract TCP sessions from PCAPs.
Python
16
star
69

prisma-cloud-best-practices

Prisma Cloud best practice documentation and guides
16
star
70

GCP-Terraform-Samples

This repository is deprecated
HCL
16
star
71

manipulate

Go library to perform CRUD operations on an Elemental model with multiple backend implementations
Go
16
star
72

minemeld-docker

Official Palo Alto Networks MineMeld docker
Shell
15
star
73

cn-series-deploy

A set of Terraform plans for deploying a Kubernetes cluster protected by a CN-Series containerize firewall
HCL
15
star
74

prisma-cloud-compute-operator

Makefile
15
star
75

prisma-cloud-go

Prisma Cloud SDK in Go
Go
15
star
76

multicloud-automation-lab

Multi-Cloud Security Automation Lab
HCL
14
star
77

pantools

A collection of pre-installed tools commonly used with Palo Alto Networks products packaged as a Docker container
Dockerfile
14
star
78

terraform-provider-cloudngfwaws

The Terraform provider for the Palo Alto Networks AWS cloud NGFW
Go
14
star
79

terraform-ansible-intro

Introduction to Terraform and Ansible
HCL
14
star
80

terraform-google-vmseries-modules

Terraform Reusable Modules for VM-Series on Google Cloud Platform (GCP)
HCL
13
star
81

wsc

wsc is a library that allows to interact with web sockets using channels.
Go
13
star
82

cn-series-helm

This repo is for deploying CN-series firewall using Helm Package Manager for Kubernetes
Mustache
13
star
83

aws-alb-sandwich

AWS ALB Sandwich with VM-Series
PHP
12
star
84

cis-benchmarks

CIS benchmark quickplay for rapid assessments of the NGFW
Jinja
12
star
85

SafeNetworking

Read only mirror. To contribute or submit issues, please go to the website link --->
Python
12
star
86

misp-to-autofocus

Script for pulling events from a MISP database and converting them to Autofocus queries.
Python
12
star
87

Prisma-Cloud-DevOps-Security

Shell
12
star
88

gcp-two-tier

VM-Series templates for Google Cloud Platform
Python
11
star
89

pcs-serverless-syslog

Prisma Cloud serverless function that can accept webhook and send alerts to syslog, S3, and SQS
Python
11
star
90

mtlsproxy

Simple mtls HTTPs proxy to use as a sidecar for protecting non critical services
Go
11
star
91

youtube-miner

MineMeld Miner for Youtube channels
Python
11
star
92

terraform-provider-prismacloud-orig

Terraform provider for Prisma Cloud
Go
11
star
93

HomeSkillet

Simple 2-zone internet gateway configuration for home use
Jinja
11
star
94

pancloud-nodejs

Palo Alto Networks Application Framework NodeJS SDK
TypeScript
11
star
95

panos-bootstrapper

A Utility to bootstrap a new PAN-OS NGFW. This utility provides an API only. An example web interface is provided here: https://github.com/PaloAltoNetworks/panos-bootstrapper-ui
Python
11
star
96

prisma-access-skillets

Suite of skillets for initial Prisma Access deployment and configuration
HCL
10
star
97

panos-bootstrapper-ui

PAN-OS Bootstrapper UI provides a simple, example web-UI that consumes the PAN-OS Bootstrapper utility API.
Python
10
star
98

terraform-iac-lab

Infrastructure as Code lab using Terraform and GCP
HCL
9
star
99

pan-threat-vault-python

Python interface to the Palo Alto Networks Threat Vault API
Python
9
star
100

azure-terraform-vmseries-fast-ha-failover

Azure Load Balancer and HA Combined Deployment for Faster Failover with no API Calls
HCL
9
star