Skip to content

kubb generate

Reads your kubb.config.ts and runs the full code-generation pipeline. This is the default command. Running kubb without any arguments is equivalent to kubb generate.

kubb generate

Usage

Generate using the input defined in your config:

shell
kubb generate

Pass an input file to override the one in your config:

shell
kubb generate ./petStore.yaml

Arguments

Argument Description
[input] Optional path or URL to a Swagger/OpenAPI document. Overrides the input set in the config.

Options

Option Default Description
--config=<path>, -c <path> Path to a specific config file (e.g. ./kubb.staging.ts).
--logLevel=<silent|info|verbose>, -l info Set verbosity. Use verbose to see plugin timing breakdowns.
--silent, -s false Shortcut for --logLevel silent. Suppresses all output.
--verbose, -v false Shortcut for --logLevel verbose. Useful for spotting slow plugins.
--reporter=<cli|json|file> cli Selects which registered reporters to trigger by name, comma separated.
--watch, -w false Re-run the generation pipeline whenever the input spec changes.

Reporters

A reporter decides how a run is rendered. The config registers the available reporters with reporters (the built-ins by default), and --reporter selects which ones to trigger by name (comma separated, like --reporter cli,file). Without the flag, the cli reporter runs. Three are built in:

Reporter Output
cli The end-of-run summary in the terminal. This is the default.
json A machine-readable report on stdout (status, counts, timings, diagnostics), for CI.
file The run's diagnostics written to .kubb/kubb-<name>-<timestamp>.log.

Write a log file without changing anything else:

shell
kubb generate --reporter file

Print a JSON report for CI and keep the exit code (non-zero on any error):

shell
kubb generate --reporter json

Examples

Run with a custom config:

shell
kubb generate --config ./kubb.staging.ts

Watch the spec and regenerate on every change:

shell
kubb generate --watch

Run with verbose plugin timings:

shell
kubb generate --verbose

See also