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
{
"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
| Key | Type | Default | Description |
|---|---|---|---|
SkipLinting | boolean | false | Skips every linting ruleset, so only validation rulesets run. |
SkipCodeGenerationChecks | boolean | — | Skips linting checks that only matter for generating SDKs and portals. Useful when you only transform your definition. |
Rulesets | object | — | 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:
| Key | Type | Description |
|---|---|---|
Skip | boolean | Skips 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. |
Rules | object | Settings 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.
| Key | Type | Description |
|---|---|---|
EnableAll | boolean | Runs every rule in the ruleset, including rules that are off by default. When true, EnableOnly and Enable are ignored. Default false. |
EnableOnly | array of strings | Runs only these rules and skips the rest. |
Enable | array of strings | Turns on rules that are off by default. |
Skip | array of strings | Skips these rules. Wins over EnableAll, EnableOnly, and Enable. |
Severity | object | Severity 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:
SkipLinting: trueskips all linting rulesets.- A ruleset's
Skip: trueskips all of its rules. - A rule listed in
Rules.Skipdoesn't run, whatever the other lists say. EnableAll: trueruns every other rule and ignoresEnableOnlyandEnable.- Otherwise,
EnableOnlylimits the ruleset to the rules it lists. - A rule's
Rules.Severityoverrides the ruleset'sSeverity.
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.