@kubb/plugin-redoc
@kubb/plugin-redoc turns your OpenAPI spec into a static HTML documentation page with Redoc. The page is self-contained. Drop it on any static host or open it locally.
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.
See also
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@betaOptions
output
Where the generated Redoc HTML file is written. The path is resolved against the global output.path on defineConfig.
| Type: | { path: string } |
|---|---|
| Required: | false |
| Default: | { path: 'docs.html' } |
output.path
File path of the generated HTML, resolved against the global output.path. Unlike most plugins, this points at a single file, not a directory.
End the path with a .html extension. If you leave the extension off, Kubb still writes the file and uses the path as the plugin output name.
| Type: | string |
|---|---|
| Required: | true |
| Default: | 'docs.html' |
import { defineConfig } from 'kubb'
import { pluginRedoc } from '@kubb/plugin-redoc'
export default defineConfig({
input: { path: './petStore.yaml' },
output: { path: './src/gen' },
plugins: [
pluginRedoc({
output: { path: 'docs.html' },
}),
],
})src/
└── gen/
└── docs.htmlExample
import { } from 'kubb'
import { } from '@kubb/adapter-oas'
import { } from '@kubb/plugin-redoc'
export default ({
: { : './petStore.yaml' },
: { : './src/gen' },
: (),
: [
({
: { : 'docs.html' },
}),
],
})