kubb validate
Checks that your Swagger/OpenAPI document is valid without running the full code-generation pipeline. Use it to catch syntax errors early in CI or before committing a spec change.
IMPORTANT
@kubb/adapter-oas is an optional peer dependency. Install it before running this command:
shell
npm i @kubb/adapter-oasUsage
Validate a local OpenAPI file:
shell
kubb validate -i ./petStore.yamlValidate a remote document:
shell
kubb validate -i https://petstore3.swagger.io/api/v3/openapi.jsonOptions
| Option | Default | Required | Description |
|---|---|---|---|
--input=<path>, -i <path> | true | Path or URL to the Swagger/OpenAPI document to validate. |
Examples
Validate a local file:
shell
kubb validate -i ./petStore.yamlValidate a remote spec in CI:
shell
kubb validate -i https://petstore3.swagger.io/api/v3/openapi.jsonTIP
kubb validate exits with a non-zero status code on failure, so you can use it as a pre-commit hook or CI step to fail the build when the spec is invalid.
See also
- Adapters: OAS adapter that parses the validated spec
- Basic usage: end-to-end walkthrough