liveBook · Manning

Override

As explained in Automating API Delivery

A Spectral override is a configuration that changes rule applicability or severity for selected API documents or objects.

Spectral overrides customize one ruleset for different OpenAPI documents or objects. They support gradual consistency: disable or lower a rule’s severity for selected live endpoints while preserving stricter checks elsewhere. section 3.9

An override identifies:

  • Target files or document fragments through a file path glob and, when needed, a JSON Pointer. section 3.9
  • The linting rule whose severity changes, such as operation-must-have-operationId: off or warn. section 3.9
  • Percent-encode path characters in pointers, as in /paths/~1users~1%7Bid%7D/put. section 3.9

Disable or warn selectively

A ruleset can turn operation-must-have-operationId off for PUT /users/{id}, but set it to warn for DELETE /users/{id}. Running `spectral lint openapi.yaml --ruleset ruleset2.yaml` reports a warning for the delete operation while suppressing the PUT violation. section 3.9

Figure 3.5 Structure of Spectral overrides
figure

Use the override structure diagram to distinguish document targets, JSON Pointer locations, and rule severity changes. section 3.9

How Automating API Delivery covers it

How deep it goes
Explains file globs, JSON Pointers, percent encoding, severities, ruleset configuration, and CLI results.
Examples
Uses a User API and targets missing operationId values on PUT and DELETE operations.
What it assumes
Assumes OpenAPI and linting familiarity while introducing JSON Pointer targeting and its required encoding.
What you can do after
Configure Spectral overrides and interpret selective lint warnings or suppressed violations.
How it connects
Connects OpenAPI documents, API linting rules, rulesets, JSON Pointer, and gradual consistency.

Also explained in

Compare how 5 books explain override →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Automating API Delivery. The section links point to the parts of the book it draws on.