@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. Your docs stay in step with the spec your code was generated from.
This plugin reads the OpenAPI adapter. Kubb uses adapterOas() by default, so it works out of the box. You set adapter yourself only if you replaced that default with another adapter.
Installation
bun add -d @kubb/plugin-redoc@betapnpm add -D @kubb/plugin-redoc@betanpm install --save-dev @kubb/plugin-redoc@betayarn add -D @kubb/plugin-redoc@betaDependencies
@kubb/plugin-redoc has no plugin dependencies. It reads the OpenAPI spec through @kubb/adapter-oas and needs no other Kubb plugin, so add it on its own whenever you want generated documentation.
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' },
}),
],
})