LintDrift
← Back to blog

Documentation coverage for TypeScript APIs

Documentation coverage is a ratio you can recompute. Take the public operations discovered from the TypeScript routes or the OpenAPI file. Take the subset that a documentation page actually describes. Coverage is the second number over the first: 42 documented out of 48 discovered, not a score a model assigned to the repo. (For why a parser should produce that number and a model should only explain it, see deterministic checks versus an AI documentation review.)

Why a single grade misleads

An overall "documentation quality" number hides the thing a platform team can act on. A repository can read well and still omit POST /api/v2/refunds. A repository can be stylistically rough and still describe every operation you ship. The first problem loses customers. The second is a writing problem.

Publish the counts:

  • Discovered operations.
  • Operations with a matching page.
  • Open findings, split by severity.
  • Findings fixed since the last scan.

Anyone can see how the number was produced. If a check is noisy, you can point at the false positive instead of debating a grade.

What to discover first

Start narrow. For a TypeScript and Node service, discover HTTP routes and the OpenAPI operations that describe them. Ignore internal helpers. A public method with no route and no spec entry is not an API consumer's problem yet.

Then look for pages under the documentation paths you configured, usually docs/** and the README, and match them to those operations by path and method. An operation with no match is missing documentation. A page that names a path the discovery step did not find is a mismatch, not a coverage win. That second case is API documentation drift, and checking it means validating the page against the OpenAPI contract, not just confirming the page exists.

Keep legacy docs out of the denominator

docs/legacy/** will wreck the ratio if you still publish it and nobody treats it as the contract. Ignore it in configuration, or the coverage line becomes a debate about old guides instead of a count of the API you support.

LintDrift shows that breakdown per repository. The number moves when an operation is added or a page is fixed, which is the only reason to put it on a dashboard. The best time to move it is the pull request that adds the operation, which is the workflow in catch outdated API docs in the pull request.

LintDrift checks TypeScript/Node repositories with OpenAPI and Markdown or MDX docs on GitHub. The Free plan covers one repository; Pro is $29/month for five, and Team is $79/month for twenty. Compare plans or start free.

Catch the next outdated endpoint before it merges.