Problem
Today the per-item documentation pages on the website are maintained by hand and are disconnected from the code that defines them:
- Linter rule pages (
website/src/content/docs/docs/libraries/<lib>/rules/<name>.md) are hand-written. The rule definition (createRule) only carries name, severity, description, url, messages — none of the page body (rationale, how-to-fix, ✅/❌ examples) lives with the code.
- Diagnostic pages (e.g.
website/src/content/docs/docs/emitters/openapi3/diagnostics.md) are hand-written. Diagnostic definitions (createTypeSpecLibrary({ diagnostics })) only carry severity + messages (plus an optional, mostly-unused description/url). tspd does not extract diagnostics at all.
- Only the linter summary page (
reference/linter.md) is auto-generated by tspd; it just links to the hand-written rule pages. There is no generated index/page for diagnostics.
This causes documentation drift, duplicated effort, and inconsistent quality across libraries and downstream emitters.
Motivation
Two concrete asks motivate a general solution:
Both boil down to the same gap: there is no structured, code-colocated place to author extended documentation for rules/diagnostics, and no tooling to auto-generate the corresponding pages.
Goal
- Add structured documentation fields to linter-rule and diagnostic definitions so docs live with the code (and examples can be validated in CI).
- Extend
tspd to extract these fields and auto-generate: per-rule pages, per-diagnostic pages, and their index pages.
- Migrate existing hand-written pages into the definitions. Generated output moves under each library's
reference/ folder; old URLs breaking is acceptable.
A detailed design proposal follows in the comment below.
Fixes #10757.
Related: Azure/typespec-azure#4791.
Problem
Today the per-item documentation pages on the website are maintained by hand and are disconnected from the code that defines them:
website/src/content/docs/docs/libraries/<lib>/rules/<name>.md) are hand-written. The rule definition (createRule) only carriesname,severity,description,url,messages— none of the page body (rationale, how-to-fix, ✅/❌ examples) lives with the code.website/src/content/docs/docs/emitters/openapi3/diagnostics.md) are hand-written. Diagnostic definitions (createTypeSpecLibrary({ diagnostics })) only carryseverity+messages(plus an optional, mostly-unuseddescription/url).tspddoes not extract diagnostics at all.reference/linter.md) is auto-generated bytspd; it just links to the hand-written rule pages. There is no generated index/page for diagnostics.This causes documentation drift, duplicated effort, and inconsistent quality across libraries and downstream emitters.
Motivation
Two concrete asks motivate a general solution:
tspd) to attach and publish extended docs per diagnostic (why it happens, how it happens, and — most importantly — what the user must do to make it go away), beyond a one-line message. Aurlper diagnostic exists today, but there is no auto-generated index/page to point it at.auth-requiredrule page.)Both boil down to the same gap: there is no structured, code-colocated place to author extended documentation for rules/diagnostics, and no tooling to auto-generate the corresponding pages.
Goal
tspdto extract these fields and auto-generate: per-rule pages, per-diagnostic pages, and their index pages.reference/folder; old URLs breaking is acceptable.A detailed design proposal follows in the comment below.
Fixes #10757.
Related: Azure/typespec-azure#4791.