Skip to content

OpenAPI docs drift

Rimfe compares an OpenAPI 3 or Swagger 2 file at the base and head of a pull request, operation by operation: added, removed and renamed operations, parameters and fields, required flags, types, enum values, defaults and deprecations. Each change is checked against the pages that document it, including Mintlify, Fumadocs and Docusaurus OpenAPI pages.

Updated

What Rimfe compares

Specs are found by name: openapi or swagger with a .json, .yaml or .yml extension, *.openapi.*, and JSON or YAML under openapi/, api-spec/ or spec/. A changed spec is always reviewed, read before other files, and never counted as a docs page.

ChangeExample
Added or removedAn operation, a parameter or a response field.
RenamedA field or parameter replaced by an identical one under a new name, or an operation that keeps its operationId on a new path.
RequiredA query parameter that becomes required.
Enumrefunded removed from an order status.
Defaultlimit moves from 20 to 50.
Typeid changes from integer to string.
DeprecatedAn operation gains deprecated: true.

How pages are matched

  • A page describes an operation when it names the path with the method nearby, or its operationId. {id}, :id and <id> are the same.
  • Rimfe reads pages a code mapping links to the spec, and pages generated from it by Fumadocs OpenAPI, Docusaurus OpenAPI or Mintlify openapi: 'GET /orders' front matter.
  • A shared schema change in #/components/schemas is reported for every operation that uses it.
  • A missing operation is reported only when every candidate page was read. With one page per operation, the finding names the page to add and the front matter it needs.

Example: an enum value is removed

docs/api/orders.mdx lists refunded as an order status. Rimfe posts a Docs conflict that quotes the spec change and the page line, with an edit that removes the value.

openapi.yaml
  status:    type: string-   enum: [pending, paid, refunded]+   enum: [pending, paid]

Example: a required parameter is added

No API page mentions currency, so Rimfe reports Missing docs, quoting the spec change. Readers who follow the current page would send a request the API now rejects.

openapi.yaml
  /orders:    post:      parameters:+       - name: currency+         in: query+         required: true+         schema: { type: string }

Example: an operation is removed

DELETE /orders/{id} is gone from the spec, but docs/api/orders.mdx still describes it. That page gets a Docs conflict quoting both.

openapi.yaml
  /orders/{id}:    get:      operationId: getOrder-   delete:-     operationId: deleteOrder

When the spec cannot be read

  • If the spec at the head is not valid JSON or YAML, it is left out, diff included, and the review is Partial and asks you to fix it. A half-written spec would read as removed operations.
  • Missing paths, an unresolved $ref, a duplicate operationId, circular and external references are listed in the run's notes, never as drift.
  • Up to 8 specs per review are compared, each up to 1 MB, 2,000 operations, 128 levels deep and 400 changes. A spec past a limit is reviewed as a text diff and the review is Partial.

Docs tools beside OpenAPI

Mintlify, ReadMe, Fumadocs and Docusaurus all build API reference from a spec. Rimfe reads reference pages that are files in your repository. When your tool renders the reference at build time or hosts it outside the repository, there is no reference file to read, so map the spec to the hand-written guides instead: authentication, errors, pagination and migration notes.

Set up a spec-first repository

A folder target checks every page in it first. A review rule can ask for an example on every new endpoint. Docs coverage counts the operations your docs mention and can fail a pull request below a floor.

.rimfe.json
{  "$schema": "https://rimfe.com/schema/rimfe.json",  "docsGlobs": ["docs/**/*.{md,mdx}"],  "codeMappings": [    { "source": "openapi.yaml", "target": "docs/api-reference/" }  ],  "rules": [    "Every new endpoint needs a request and response example in docs/api-reference"  ],  "coverageFloor": 80}

Limits

  • Only references inside the same file are followed. A spec split across files is compared one file at a time.
  • Rimfe is not a spec linter. Keep one in CI.
  • AsyncAPI files are reviewed from their diff, without the structural comparison.

Try it on your next pull request.

Free for public repositories, with unlimited members.

Start free with GitHub