Skip to content

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

CommandDoes
initCreate a swaggerz.config.{ts,mjs,json,yaml} file for this project.
generate (gen)Generate the API client from the specification.
validateValidate the configuration and specification and generate in memory, without writing files.
lintReport what in the specification makes the generated client worse: missing operationIds, untyped responses, inline schemas and more.
inspectPrint a summary of the operations and models that would be generated.
dashboardStart the local dashboard to explore operations, models, dependencies and usage.
mcpRun a Model Context Protocol server on stdio so coding agents can look up the generated client.
cleanRemove generated files. Only files recorded in the output manifest are removed.
doctorCheck the environment, configuration, specification, output directory and dependencies.

swaggerz init

Create a swaggerz.config.{ts,mjs,json,yaml} file for this project.

--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.

swaggerz generate

Generate the API client from the specification.

Alias: gen

-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.

swaggerz validate

Validate the configuration and specification and generate in memory, without writing files.

swaggerz lint

Report what in the specification makes the generated client worse: missing operationIds, untyped responses, inline schemas and more.

--max-warnings <n>
Fail when there are more than n warnings (default: no limit).
--rules
List the rules with their configured severity.

swaggerz inspect

Print a summary of the operations and models that would be generated.

--operations
Only list operations.
--models
Only list models.
--filter <text>
Only show entries whose name, path or tag contains the text.

swaggerz dashboard

Start the local dashboard to explore operations, models, dependencies and usage.

--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).

swaggerz mcp

Run a Model Context Protocol server on stdio so coding agents can look up the generated client.

--allow-write
Offer the generate tool, which writes the output directory.
--no-watch
Do not reload when the config, specification or output changes.

swaggerz clean

Remove generated files. Only files recorded in the output manifest are removed.

--dry-run
List the files that would be removed.
--force
Also remove generated files that were edited by hand.

swaggerz doctor

Check the environment, configuration, specification, output directory and dependencies.

Global options

Every command accepts these.

-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.

Exit codes

CodeMeaning
0Success.
1Failed checks, an invalid specification or generation errors (diagnostics were printed).
2Invalid usage or configuration, including an unsafe output directory.
3An unexpected internal error; please report it.