liveBook · Manning

Gradual consistency approach

As explained in Automating API Delivery

A gradual consistency approach applies a shared ruleset incrementally by selectively enabling, disabling, or regrading rules for specific API objects.

When an existing API cannot satisfy every lint rule immediately, keep one shared ruleset and introduce compliance incrementally. Enable passing rules, then disable or regrade failing rules for specific OpenAPI objects. New extensions still meet current standards, while exceptions remain visible for later nondisruptive improvements. section 3.9

Implement the approach with targeted Spectral overrides:

  • Identify the OpenAPI document and object that cannot yet satisfy a rule. section 3.9
  • Use a file path glob and JSON pointer to target that object. section 3.9
  • Set the rule to off or warn instead of removing it from the shared ruleset. section 3.9
  • Revisit disabled rules when a nondisruptive API change becomes possible; some live endpoints may retain exceptions. section 3.9

Selective operationId enforcement

A shared rule requires every operation to have an operationId. An override turns it off for PUT /users/{id} and changes it to warn for DELETE /users/{id}; linting then reports the delete operation as a warning rather than an error.

How Automating API Delivery covers it

How deep it goes
Explains object-level Spectral overrides using file globs, JSON pointers, rule names, and severity changes.
Examples
Uses operationId enforcement on GET, PUT, and DELETE operations under /users/{id}.
What it assumes
Assumes an OpenAPI document and linting ruleset, while introducing JSON pointer targeting for overrides.
What you can do after
Apply it via Spectral to enforce current rules while managing documented exceptions for individual API objects.
How it connects
Connects API linting with OpenAPI, Spectral overrides, JSON Pointer, and rule severity.

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.