kubb validate
Run kubb validate to check a specification with the adapter in your Kubb config, without running generation. Use it to catch errors early in CI or before you commit a spec change. Without a config, it uses @kubb/adapter-oas for OpenAPI and Swagger documents.
The input can also be a URL, such as https://petstore3.swagger.io/api/v3/openapi.json, or a file in a git repository, such as git+https://github.com/org/api.git#main:specs/openapi.yaml. Kubb fetches a git input into a temporary folder with git, validates it, and deletes the folder. See input for the format.
The summary shows the result and elapsed time before the input and the adapter's name. Validation runs no generator plugins and writes no generated files. A failure includes the validation error. When the default OpenAPI adapter is missing, the error includes its installation command.
The command discovers the project's config or accepts --config <path> (-c). Each config's adapter validates the supplied input, with local paths resolved from that config's root, or the current directory when root is omitted. A URL or git input is passed unchanged. A config without an adapter fails instead of substituting the OpenAPI adapter.
kubb validate ./schema.graphql --config ./kubb.config.tsArguments
| Argument | Required | Description |
|---|---|---|
<input> | true | Path, URL, or git input (git+<repo>#<ref>:<path>) of the specification to validate. |
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.