Skip to content
Official v5.0.0-beta.103 MIT kubb >=5.0.0 node >=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
Downloads
27.9k / mo
Stars
5
Bundle size
26.7 kB
Updated
2d ago

@kubb/plugin-redoc

@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@beta
shell
pnpm add -D @kubb/plugin-redoc@beta
shell
npm install --save-dev @kubb/plugin-redoc@beta
shell
yarn add -D @kubb/plugin-redoc@beta

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.

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