Beta You're reading the docs for Kubb v5, which is currently in beta. View the stable v4 docs
Skip to content
Tags
redocapi-docsdocumentationinteractive-docscodegenopenapi
Details
  • Updated today
  • Created 2 years ago
Official v5.0.0-beta.73 MIT kubb >=5.0.0 node >=22

@kubb/plugin-redoc

Render your OpenAPI spec as a single-file HTML page using Redoc, regenerated as part of the Kubb build.

Downloads
41.2k / mo
Stars
3
Bundle size
27.5 kB
Updated
today

@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

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

Options

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'
typescript
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' },
    }),
  ],
})
text
src/
└── gen/
    └── docs.html

Example

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

export default ({
  : { : './petStore.yaml' },
  : { : './src/gen' },
  : (),
  : [
    ({
      : { : 'docs.html' },
    }),
  ],
})

See Also