Skip to content
Plugin
Redoc
plugins: [pluginRedoc()]
Officialv5.0.8kubb >=5.8.3node >=22

Redoc

@kubb/plugin-redoc

Generates a single-file HTML page from your OpenAPI spec with Redoc, rebuilt on every Kubb run so the docs match the spec your code comes from.

kubb add plugin-redoc
redocapi-docsdocumentationinteractive-docscodegenopenapi

The Redoc plugin generates a single HTML page that documents your OpenAPI spec with Redoc.

The whole spec is embedded in the page, so you can publish the page to any static host without a build step. Viewing the page needs network access, because it loads a pinned Redoc bundle from jsDelivr, checked with a Subresource Integrity hash, and its fonts from Google Fonts.

Installation

bun add -d @kubb/plugin-redoc

Or run kubb add plugin-redoc to install the version the Kubb registry pins and add pluginRedoc() to kubb.config.ts.

Setup

No other plugins or packages are needed. The plugin reads the spec through the default OpenAPI adapter, adapterOas, and fails with any other adapter.

Options worth knowing

  • output.path sets the HTML file path, relative to the root output.path. The default is docs.html. End it with .html, because it names a file, not a folder.

The plugin has no other options. See Options for its type and default.

Example

The config below writes the page to src/gen/docs.html.

kubb.config.ts
import { defineConfig } from 'kubb/config'
import { pluginRedoc } from '@kubb/plugin-redoc'

export default defineConfig({
  input: './petStore.yaml',
  output: { path: './src/gen' },
  plugins: [
    pluginRedoc({ output: { path: 'docs.html' } }),
  ],
})

Dependencies

No extension dependencies.