Skip to content
Tags
redocapi-docsdocumentationinteractive-docscodegenopenapi
Details
  • Updated today
  • Created 2 years ago
Official v5.0.0-beta.42 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
45.6k / mo
Stars
3
Bundle size
39.5 kB
Updated
today

@kubb/plugin-redoc

Generate a static HTML documentation page for your OpenAPI spec using Redoc. The page is self-contained — drop it on any static host or open it locally.

Because the file is regenerated on every Kubb build, your docs stay in lockstep with the spec your code was generated from.

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

Output location of the generated HTML file.

Type: { path: string }
Required: false
Default: { path: 'docs.html' }

output.path

File path of the generated HTML, relative to the global output.path.

Use a .html extension. Unlike most plugins, this option points at a single file rather than a directory.

Type: string
Required: true
Default: 'docs.html'

TIP

When output.path points to a single file, the group option cannot be used because every operation ends up in the same file.

typescript
import { defineConfig } from 'kubb'
import { pluginTs } from '@kubb/plugin-ts'

export default defineConfig({
  input: { path: './petStore.yaml' },
  output: { path: './src/gen' },
  plugins: [
    pluginTs({
      output: { path: './types' },
    }),
  ],
})
text
src/
└── gen/
    └── types/
        ├── Pet.ts
        └── Store.ts

Example

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' },
    }),
  ],
})

See Also