Define & Validate APIsValidate & Lint

Configure Validation

Skip linting rulesets, turn individual rules on or off, and change rule severity with ValidationConfiguration in the APIMatic Metadata file.

APIMatic runs every ruleset that applies to your API definition, with each rule's default severity. To change that, add ValidationConfiguration to the APIMatic Metadata file next to your definition.

Add only the settings you want to change. Rulesets and rules you don't list keep their defaults.

Only linting rulesets and rules can be configured. Validation rules always run, and their severity can't be changed.

Example

src/spec/APIMATIC-META.json
{
  "ValidationConfiguration": {
    "SkipLinting": false,
    "Rulesets": {
      "openapi-v3-standards-linting": {
        "Severity": "Information",
        "Rules": {
          "EnableOnly": [
            "unique-case-insensitive-header-parameter-names",
            "no-ambiguous-path",
            "valid-schema-example"
          ],
          "Skip": ["no-ambiguous-path"],
          "Severity": {
            "valid-schema-example": "Error"
          }
        }
      },
      "openapi-v3-apimatic-linting": {
        "Skip": true
      }
    }
  }
}

This runs only two rules of OpenAPI v3 Standards Linting, unique-case-insensitive-header-parameter-names at Information and valid-schema-example at Error, and skips OpenAPI v3 APIMatic Linting entirely.

ValidationConfiguration

KeyTypeDefaultDescription
SkipLintingbooleanfalseSkips every linting ruleset, so only validation rulesets run.
SkipCodeGenerationChecksboolean—Skips linting checks that only matter for generating SDKs and portals. Useful when you only transform your definition.
Rulesetsobject—Settings per ruleset. Each key is a ruleset's ID or code prefix, for example openapi-v3-standards-linting or OPENAPI3STANDARDS_L. See Ruleset settings.
{
  "ValidationConfiguration": {
    "SkipLinting": true
  }
}

Ruleset settings

Each entry in Rulesets can have these keys:

KeyTypeDescription
SkipbooleanSkips every rule in the ruleset. Default false.
Severity"Error" | "Warning" | "Information"Severity for every rule in the ruleset. A rule's own severity in Rules.Severity overrides it.
RulesobjectSettings for individual rules. See Rule settings.

Rule settings

Rules are identified by their ID or code, for example no-ambiguous-path or OPENAPI3STANDARDS_L065. You can look both up in the ruleset tables.

KeyTypeDescription
EnableAllbooleanRuns every rule in the ruleset, including rules that are off by default. When true, EnableOnly and Enable are ignored. Default false.
EnableOnlyarray of stringsRuns only these rules and skips the rest.
Enablearray of stringsTurns on rules that are off by default.
Skiparray of stringsSkips these rules. Wins over EnableAll, EnableOnly, and Enable.
SeverityobjectSeverity per rule, for example { "valid-schema-example": "Error" }. Values are Error, Warning, or Information.

Which setting wins

When settings overlap, they're applied in this order:

  1. SkipLinting: true skips all linting rulesets.
  2. A ruleset's Skip: true skips all of its rules.
  3. A rule listed in Rules.Skip doesn't run, whatever the other lists say.
  4. EnableAll: true runs every other rule and ignores EnableOnly and Enable.
  5. Otherwise, EnableOnly limits the ruleset to the rules it lists.
  6. A rule's Rules.Severity overrides the ruleset's Severity.

Mistakes the metadata file is checked for

APIMatic checks ValidationConfiguration with the Metadata File Validation ruleset. An unknown ruleset key (METADATA_V200) or rule identifier (METADATA_V202) is reported as an error.

On this page