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.
Usage
Generate using the input defined in your config:
kubb generatePass an input file to override the one in your config:
kubb generate ./petStore.yamlArguments
| 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:
kubb generate --reporter filePrint a JSON report for CI and keep the exit code (non-zero on any error):
kubb generate --reporter jsonExamples
Run with a custom config:
kubb generate --config ./kubb.staging.tsWatch the spec and regenerate on every change:
kubb generate --watchRun with verbose plugin timings:
kubb generate --verboseSee also
- Configuration: full reference for
kubb.config.ts - Basic usage: end-to-end walkthrough
- Plugins: available plugins for code generation