feat(tspd): auto-generate linter rule and diagnostic reference pages#11221
feat(tspd): auto-generate linter rule and diagnostic reference pages#11221tadelesh wants to merge 1 commit into
Conversation
commit: |
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
717ed80 to
9b20068
Compare
Add an optional docs field (raw markdown, loaded from a co-located .md file) to linter rule (createRule) and diagnostic (createTypeSpecLibrary) definitions. tspd renders a page per rule (reference/rules/<name>.md) and per diagnostic (reference/diagnostics/<code>.md) plus a diagnostics index, and reports documentation-missing for undocumented rules/diagnostics. Migrates @typespec/http op-reference-container-route and @typespec/openapi3 path-query as pilots. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9b20068 to
1a02a89
Compare
Fixes #11141
Auto-generate a reference documentation page per linter rule and per diagnostic, so these pages stop being hand-written and drift-prone.
What's included
@typespec/tspd:tspd docnow rendersreference/rules/<name>.mdreference/diagnostics/<code>.md+ a diagnostics indexdocumentation-missingwarning for rules/diagnostics without docs (only for libraries that have started documenting, to avoid noise).@typespec/http—op-reference-container-routerule.@typespec/openapi3— 6 diagnostics (path-query,duplicate-header,inline-cycle,invalid-schema,invalid-server-variable,union-null).@typespec/openapi— 2 diagnostics (duplicate-type-name,invalid-extension-key) that were previously (mis-)documented on the openapi3 page.How docs are authored
Extended docs are authored as a co-located markdown file, read from source by
tspdat doc-generation time using a precise per-item convention:src/rules/<rule-name>.mdsrc/diagnostics/<code>.mdtspdreads exactly that one file per rule/diagnostic (nosrc/**/*.mdglob), so a stray.mdinsrcis never picked up. The library itself never loads the file at runtime, so nothing extra ends up in the browser/playground bundle. A library only gets a generated diagnostics index/pages once it has at least one documented item.Validation
compiler,tspd,http,openapi,openapi3; regen is stable (running it twice produces no diff).regen-ing libraries with no documented diagnostics (e.g.json-schema) produces no new files.lintgreen for the touched packages;op-reference-container-routerule tests pass;openapiapi-extractor passes ($libre-exported as@internalsotspdcan enumerate diagnostics).