@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
bun add -d @kubb/plugin-redocpnpm add -D @kubb/plugin-redocnpm install --save-dev @kubb/plugin-redocyarn add -D @kubb/plugin-redocDependencies
@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
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' },
}),
],
})