Open Studio
Officialv5.0.2MITkubb >=5.0.0node >=22

@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.

redocapi-docsdocumentationinteractive-docscodegenopenapi
Stijn Van Hulle

Stijn Van Hulle

@stijnvanhulle

Downloads
34.1k/ mo
Stars
8
Bundle size
27.0 kB
Updated
3w ago

@kubb/plugin-redoc turns your OpenAPI spec into a static HTML documentation page with Redoc. The output is a single file with the spec embedded inline, so you can drop it on any static host without a build step. The page loads the Redoc bundle and fonts from a CDN when viewed, so rendering needs network access.

Kubb rebuilds the file on every run, keeping your docs in step with the spec your code was generated from.

This plugin reads the OpenAPI adapter, which Kubb sets to adapterOas() by default, so it works out of the box. Set adapter yourself only if you replaced that default.

Installation ​

shell
bun add -d @kubb/plugin-redoc
shell
pnpm add -D @kubb/plugin-redoc
shell
npm install --save-dev @kubb/plugin-redoc
shell
yarn add -D @kubb/plugin-redoc

Dependencies ​

@kubb/plugin-redoc has no plugin dependencies. It reads the OpenAPI spec through @kubb/adapter-oas, so add it on its own whenever you want generated documentation.

Important

The generated page loads Redoc from a CDN, so there is no package to install.

Example ​

typescript
import { defineConfig } from 'kubb'
import { adapterOas } from '@kubb/adapter-oas'
import { pluginRedoc } from '@kubb/plugin-redoc'

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

See also ​