Repository navigation
Description
Summary
Make each protocol docs page find its content by schema name instead of hand-typed file paths and line numbers, and remove the generator scripts that are no longer needed.
Rationale
The protocol pages work, but keeping them correct takes more manual effort than it should:
- Each schema section finds its TypeSpec, Python and TypeScript snippets by a file path and a pair of line numbers typed into the page's frontmatter. There are 240 of these across 40 pages
- Editing a source file shifts its line numbers, and nothing checks them, so a snippet can silently show the wrong lines. The TypeScript tab on the date types page and the
AwdIdsTypeSpec tab on the award page are wrong on the live site today - Adding a schema means writing about 25 lines of frontmatter and looking up line numbers in three source files
- Two of the four
generate-*.tsscripts (generate-schema-metadata.ts,generate-type-formatting.ts) write output that nothing reads
The benefits of the change:
- A page names the schema, and the site finds the JSON Schema, the TypeSpec source and the SDK code for it at build time
- Source edits can't break a snippet, and a snippet that can't be found fails the build instead of publishing
- Adding a schema is one short section in its page, with no line numbers, no file paths and no script run
pnpm devandpnpm buildrun one docs generator instead of four
Approach
The pages stay as MDX. This issue first proposed porting to a catalog file and a dynamic route, the way CommonBenefits does it. That fits a site whose schema pages are only a table and code tabs. Nearly every schema section here also has hand-written prose, such as what changed in v0.5 and how a field should be read, and a generated page has no place for it.
So the catalog and dynamic route are out of scope. What carries over from CommonBenefits is finding a declaration by name, as its typespec-extractor.ts does.
Implementation notes
- Find TypeSpec declarations by schema name. 142 of the 144 schema names are declared in exactly one
.tspfile underlib/core/lib/ - Find the Python and TypeScript declarations by name too. About 20 are named differently from the schema (the filter operator enums, for example), so a section needs a way to give the SDK name explicitly
- Keep the 50 hand-written examples. The rest are already generated from the schema
- Build the schema-to-page map that powers cross-links while the site builds, replacing
generate-schema-docs.ts - Remove
generate-schema-metadata.ts,generate-type-formatting.tsand the unusedSchemaMetadataLoader - Keep
generate-versioned-schemas.ts. It writes the per-version schema files that every Changelog section links to, and thatcompetition.mdx,form.mdxand a mock conformance test read from disk
Acceptance criteria
- Every code snippet on the protocol pages shows its complete declaration, including the ones that are cut off or wrong today
- Everything else on every protocol page (tables, examples, prose, changelogs, links) is unchanged, shown by comparing the built pages before and after
- Adding a schema is one section in its MDX page that names the schema, with no line numbers, no file paths and no script run
- The build fails when a page names a schema or a snippet that can't be found
-
generate-schema-docs.ts,generate-schema-metadata.tsandgenerate-type-formatting.tsare removed and the website still builds clean
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Review
Activity
SnowboardTechie commentedon Nov 19, 2026
I looked into this before starting the v0.6 docs tickets and reworked the description above. What changed from the original:
generate-versioned-schemas.tsstays because the Changelog sections link to the files it writes.website/cache/is already gitignored.This also keeps line numbers out of the v0.6 model and type page updates in the models, types and API docs dropdown ticket, so I'm doing it ahead of that one.