kubb validate
Run kubb validate to check that a Swagger/OpenAPI document is valid without running the pipeline. Use it to catch errors early in CI or before you commit a spec change.
shell
command: kubb validate -i ./petStore.yaml
output:
- ✅ Validation successIMPORTANT
@kubb/adapter-oas is an optional dependency. Install it before you run this command:
shell
npm i @kubb/adapter-oas@betaUsage
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. |
TIP
kubb validate exits with a non-zero status code when the spec is invalid. Use it as a pre-commit hook or CI step to fail the build.
See also
- Adapters: OAS adapter that parses the validated spec
- Basic usage: end-to-end walkthrough