Validate & Lint Overview
Check the syntax and semantics of your API definition before you generate anything from it.
When you import an API definition, APIMatic runs validation and linting checks on it and reports every issue it finds. Fixing these first gives you better APIMatic SDKs, docs, and portals.
Validate with the APIMatic CLI
apimatic api validate
apimatic api validate --file=<path>
apimatic api validate --url=<url>With no flags, the command validates the API definition in your project's src directory. Run it from the folder that contains src, or pass that folder with --input. To validate a single file instead, use --file or --url. For every flag, see api validate in the CLI Reference.
Validate in VS Code
To validate locally while you edit, use APIMatic for VS Code. It checks your definition against APIMatic's validation and linting rules as you save, explains each issue, and can fix common issues automatically.
Validate pull requests on GitHub
The APIMatic OpenAPI Linter GitHub App validates the OpenAPI definitions in your repository on every pull request and reports the results as a PR comment and a GitHub check.
Rules and rulesets
Each APIMatic check is a rule, and rules are grouped into rulesets. A rule is identified by its ruleset ID and rule ID, for example apimatic-preliminary-validation:required-server-url, or by a rule code such as APIMATICPRE_V036.
There are two kinds of rules:
- Validation rules make sure your API definition conforms to its format and is technically correct.
- Linting rules are style checks and recommendations. They improve the definition without affecting whether it's valid.
See Rulesets Overview for every ruleset and rule, by format. To skip linting rules or change their severity, see Configure Validation.
Rules check two things:
- Syntax: the structure of expressions and statements is valid.
- Semantics: the definition makes sense in context.
Severity levels
Messages are reported at one of four levels, from most to least severe:
| Severity | What it means |
|---|---|
| Blocking | A critical issue that stops validation from continuing. |
| Error | A syntax or semantic problem you must fix before any output is generated. |
| Warning | Doesn't block processing, but can lower the quality of what's generated. |
| Information | A suggestion to make your API definition more complete. |
Merge Multiple API Definitions
Combine several API definitions, in the same or different formats, into one API with MergeConfiguration in the APIMatic Metadata file.
Configure Validation
Skip linting rulesets, turn individual rules on or off, and change rule severity with ValidationConfiguration in the APIMatic Metadata file.