04Reference
CLI
Every command and flag of the swaggerz CLI, read from the definitions it parses its arguments with.
Installed as swaggerz and sz. Run swaggerz <command> --help for the same text in a terminal.
Commands
| Command | Does |
|---|---|
init | Create a swaggerz.config.{ts,mjs,json,yaml} file for this project. |
generate (gen) | Generate the API client from the specification. |
validate | Validate the configuration and specification and generate in memory, without writing files. |
lint | Report what in the specification makes the generated client worse: missing operationIds, untyped responses, inline schemas and more. |
inspect | Print a summary of the operations and models that would be generated. |
dashboard | Start the local dashboard to explore operations, models, dependencies and usage. |
mcp | Run a Model Context Protocol server on stdio so coding agents can look up the generated client. |
clean | Remove generated files. Only files recorded in the output manifest are removed. |
doctor | Check the environment, configuration, specification, output directory and dependencies. |
swaggerz init
Create a swaggerz.config.{ts,mjs,json,yaml} file for this project.
Usage: swaggerz init [options]
Create a swaggerz.config.{ts,mjs,json,yaml} file for this project.
Options: --spec <path|url> Specification file or URL (default: detected). --spec-version <2.0|3.0|3.1|3.2|auto> Specification version (default: detected). --output <dir> Output directory (default: ./src/generated/api). --language <typescript|javascript> Output language (default: detected). --adapter <fetch|axios> HTTP adapter (default: fetch). --query <react|vue|svelte|solid> Generate TanStack Query hooks for a framework (default: detected). --react-query Same as --query react. --swr Generate SWR hooks (default: detected). --validation <zod|valibot|arktype> Validate responses at runtime with this library. --no-detect Do not pick the hooks from package.json's dependencies. --format <ts|js|json|yaml> Config file format (default: ts in TypeScript projects, otherwise js). --force Overwrite an existing config file.
Global options: -c, --config <path> Path to the config file. --cwd <dir> Working directory (default: current directory). --verbose Show notes, timings and details. -q, --quiet Only print errors. --json Print a machine-readable JSON result. --color Force colored output. --no-color Disable colored output. -h, --help Show help.swaggerz generate
Generate the API client from the specification.
Alias: gen
Usage: swaggerz generate [options]
Generate the API client from the specification.
Options: -w, --watch Regenerate when the specification or config changes. --dry-run Show what would change without writing files. --check Write nothing; exit with 1 and list the differences when the output is not up to date (for CI). --force Overwrite files the generator does not own and delete edited stale files. --no-clean Keep generated files that are no longer produced.
Global options: -c, --config <path> Path to the config file. --cwd <dir> Working directory (default: current directory). --verbose Show notes, timings and details. -q, --quiet Only print errors. --json Print a machine-readable JSON result. --color Force colored output. --no-color Disable colored output. -h, --help Show help.swaggerz validate
Validate the configuration and specification and generate in memory, without writing files.
Usage: swaggerz validate [options]
Validate the configuration and specification and generate in memory, without writing files.
Global options: -c, --config <path> Path to the config file. --cwd <dir> Working directory (default: current directory). --verbose Show notes, timings and details. -q, --quiet Only print errors. --json Print a machine-readable JSON result. --color Force colored output. --no-color Disable colored output. -h, --help Show help.swaggerz lint
Report what in the specification makes the generated client worse: missing operationIds, untyped responses, inline schemas and more.
Usage: swaggerz lint [options]
Report what in the specification makes the generated client worse: missing operationIds, untyped responses, inline schemas and more.
Options: --max-warnings <n> Fail when there are more than n warnings (default: no limit). --rules List the rules with their configured severity.
Global options: -c, --config <path> Path to the config file. --cwd <dir> Working directory (default: current directory). --verbose Show notes, timings and details. -q, --quiet Only print errors. --json Print a machine-readable JSON result. --color Force colored output. --no-color Disable colored output. -h, --help Show help.swaggerz inspect
Print a summary of the operations and models that would be generated.
Usage: swaggerz inspect [options]
Print a summary of the operations and models that would be generated.
Options: --operations Only list operations. --models Only list models. --filter <text> Only show entries whose name, path or tag contains the text.
Global options: -c, --config <path> Path to the config file. --cwd <dir> Working directory (default: current directory). --verbose Show notes, timings and details. -q, --quiet Only print errors. --json Print a machine-readable JSON result. --color Force colored output. --no-color Disable colored output. -h, --help Show help.swaggerz dashboard
Start the local dashboard to explore operations, models, dependencies and usage.
Usage: swaggerz dashboard [options]
Start the local dashboard to explore operations, models, dependencies and usage.
Options: --host <host> Interface to bind (default: 127.0.0.1). --port <port> Port (default: 4400; the next free port is used if taken). --open Open the dashboard in the default browser. --no-watch Do not reload when the config, specification or output changes (use the Reload button instead).
Global options: -c, --config <path> Path to the config file. --cwd <dir> Working directory (default: current directory). --verbose Show notes, timings and details. -q, --quiet Only print errors. --json Print a machine-readable JSON result. --color Force colored output. --no-color Disable colored output. -h, --help Show help.swaggerz mcp
Run a Model Context Protocol server on stdio so coding agents can look up the generated client.
Usage: swaggerz mcp [options]
Run a Model Context Protocol server on stdio so coding agents can look up the generated client.
Options: --allow-write Offer the generate tool, which writes the output directory. --no-watch Do not reload when the config, specification or output changes.
Global options: -c, --config <path> Path to the config file. --cwd <dir> Working directory (default: current directory). --verbose Show notes, timings and details. -q, --quiet Only print errors. --json Print a machine-readable JSON result. --color Force colored output. --no-color Disable colored output. -h, --help Show help.swaggerz clean
Remove generated files. Only files recorded in the output manifest are removed.
Usage: swaggerz clean [options]
Remove generated files. Only files recorded in the output manifest are removed.
Options: --dry-run List the files that would be removed. --force Also remove generated files that were edited by hand.
Global options: -c, --config <path> Path to the config file. --cwd <dir> Working directory (default: current directory). --verbose Show notes, timings and details. -q, --quiet Only print errors. --json Print a machine-readable JSON result. --color Force colored output. --no-color Disable colored output. -h, --help Show help.swaggerz doctor
Check the environment, configuration, specification, output directory and dependencies.
Usage: swaggerz doctor [options]
Check the environment, configuration, specification, output directory and dependencies.
Global options: -c, --config <path> Path to the config file. --cwd <dir> Working directory (default: current directory). --verbose Show notes, timings and details. -q, --quiet Only print errors. --json Print a machine-readable JSON result. --color Force colored output. --no-color Disable colored output. -h, --help Show help.Global options
Every command accepts these.
Exit codes
| Code | Meaning |
|---|---|
0 | Success. |
1 | Failed checks, an invalid specification or generation errors (diagnostics were printed). |
2 | Invalid usage or configuration, including an unsafe output directory. |
3 | An unexpected internal error; please report it. |