Consume canonical TypeScript API exports - #1430
Conversation
Validates schema version 1 documents produced by `aspire sdk export` before the site reads them: unknown schema versions, the wrong language, missing package identity, duplicate stable IDs, declaration IDs that disagree on content, and blank signatures are all rejected at the input rather than surfacing as empty code blocks on a published page. The fixtures are unedited CLI output for one core and one integration package. Their combined declaration fragments type-check with noEmit and skipLibCheck disabled, which is what lets the site stop authoring shims. No signature conversion here; consumers still read the existing data. Co-authored-by: Copilot <[email protected]> Copilot-Session: 819baaf4-91c3-44ce-8004-3dbc9110f810
Regenerated with the producer fixes: augmentation item IDs now carry the contributing package so two integrations extending DistributedApplicationBuilder cannot collide, and CreateBuilderOptions gained the client-only throwOnPendingRejections property the module has always shipped. Co-authored-by: Copilot <[email protected]> Copilot-Session: 819baaf4-91c3-44ce-8004-3dbc9110f810
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
There was a problem hiding this comment.
Pull request overview
Introduces a v1 “canonical TypeScript API export” contract (as produced by aspire sdk export --language typescript) into the frontend, along with fixtures and unit tests, so the site can validate/sort/dedupe/render the CLI-produced API surface instead of reconstructing TypeScript signatures locally.
Changes:
- Added
typescript-api-exportschema types + parser/validator + declaration concatenation helper. - Added raw CLI output fixtures for
Aspire.HostingandAspire.Hosting.Redis, plus unit tests validating the contract and cross-package invariants. - Re-exported the canonical schema types from
ts-modules.tsto provide a single import path for consumers during migration.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/frontend/src/schemas/typescript-api-export.ts | Adds v1 schema types, validation, loader, and declaration concatenation. |
| src/frontend/src/utils/ts-modules.ts | Type-only re-export of canonical export types for downstream imports. |
| src/frontend/tests/unit/typescript-api-export.vitest.test.ts | Adds validation tests + a tsc --noEmit --strict typecheck over concatenated fragments. |
| src/frontend/tests/fixtures/typescript-api-export/Aspire.Hosting.Redis.api.json | Adds raw CLI export fixture for the Redis integration package. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Adam Ratzman (adamint)
left a comment
There was a problem hiding this comment.
I found three contract gaps inline. I did not repeat the existing tsc stderr comment. CI is also blocked by the forbidden-words check because the raw Aspire.Hosting.api.json fixture contains app host; since the fixture is intentionally unedited, I think this either needs the producer output refreshed or the bypass label.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 14e6fead-9dad-4880-bdaf-75663b728b67
David Pine (IEvangelist)
left a comment
There was a problem hiding this comment.
Accuracy source: microsoft/aspire main @ 00d3ddb8ddadc3824d2086269ff05457cb497645
Summary: 23 claims checked: 17 verified, 4 verified with nuance, 2 contradicted, 0 unverifiable. The two contradictions are blocking and are called out inline. The doc-tester pass found no affected documentation routes; the PR head served successfully at http://localhost:4322/ with 0 critical issues and 0 warnings.
Phase A — Claim verification
Verified and verified-with-nuance claims
| ID | Verdict | Claim and evidence |
|---|---|---|
| C1 | Verified | aspire sdk export --language typescript exists (SdkExportCommand.cs: command/option definitions). |
| C2 | Verified | schemaVersion is literal 1 (TypeScriptApiProjector.ExportSchemaVersion). |
| C3 | Verified | Exported document language is lowercase typescript (TypeScriptApiProjector.cs). |
| C4 | Verified | Package identity contains non-empty name and version (TypeScriptApiExportWriter.cs). |
| C5 | Verified | Modules contain name, optional summary, and items; the producer currently emits one module. |
| C6 | Verified | Items emit id, kind, name, declaration, and owningAssembly. |
| C7 | Verified with nuance | The consumer permits missing typeId, although the producer requires and always emits it. |
| C8 | Verified | Item examples and extends are optional string arrays. |
| C9 | Verified with nuance | The producer also emits member-level examples; parseMember currently drops that field. |
| C10 | Verified | Member deprecation text is serialized under deprecated. |
| C11 | Verified | Parameters serialize as name, type, optional, and optional summary. |
| C12 | Verified | Declarations contain non-empty id, content, and owningAssembly. |
| C13 | Verified with nuance | The producer emits a top-level generator object; the consumer currently drops it. |
| C14 | Verified | Method declarations use the documented TypeScript signature form. |
| C15 | Verified | Item declarations use headers such as export interface RedisResource. |
| C16 | Verified | Extension methods are augmentation items with package-qualified augmentation IDs. |
| C19 | Verified | Exact repeated declarations are harmless within the consumer's dedupe behavior. |
| C20 | Verified | Fixture declaration IDs are unique and sorted for the tested inputs. |
| C21 | Verified with nuance | The concatenated core + Redis fixture type-checks, but this does not establish correctness for the full multi-package manifest. |
| C22 | Verified | The type-only re-export is erased and does not introduce node:fs into page bundles. |
| C23 | Verified | Fixture shape and field order match raw producer output, including generator. |
The producer evidence is in TypeScriptApiModel.cs, TypeScriptApiExportWriter.cs, TypeScriptApiProjector.cs, AtsTypeScriptApiReferenceExporter.cs, and SdkExportCommand.cs at the SHA above.
Phase B — Doc-tester results
Documentation Test Report
Focus Area: PR #1430 — no documentation content or rendered routes changed
Date: 2026-08-25
Tester: doc-tester agent
PR ref served: 0fe13f5d23fe84a20c60815e167ee4cdeefe36c0 at http://localhost:4322/
| Category | Passed | Failed | Warnings |
|---|---|---|---|
| Content Accuracy | 0 | 0 | 0 |
| Code Examples | 0 | 0 | 0 |
| CLI Commands | 0 | 0 | 0 |
| Links | 0 | 0 | 0 |
Critical Issues
None. No documentation pages or sections changed in this PR.
Warnings
None.
Passed Checks
- The PR head served locally and
/loaded successfully with the expected site title. - The changed-file set contains only the TypeScript export schema, utility re-export, fixtures, and unit tests; there are no affected documentation routes to exercise.
Recommendations
None for rendered documentation in this PR.
Knowledge Gaps
None.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 14e6fead-9dad-4880-bdaf-75663b728b67
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 14e6fead-9dad-4880-bdaf-75663b728b67
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 14e6fead-9dad-4880-bdaf-75663b728b67
Draft. Consumer half of microsoft/aspire#19032 — tracking #17608.
Today
AtsJsonGeneratorreconstructs TypeScript signatures on the site side: options-overload synthesis, C# inheritance borrowing, container-base inference, missing-declaration stubs. It's a second implementation of the TypeScript projection that lives in the wrong repo, and it drifts from what the generator actually emits. That's the bug behind #17608.The plan is for the CLI to hand us the API surface for an exact
Name@Versionand for this repo to do nothing but validate, sort, dedupe, and write.What's in the draft so far
The schema v1 contract and the fixtures, so the switchover has something to land against:
src/schemas/typescript-api-export.ts— parser/validator, typed loader,concatenateDeclarationstests/fixtures/typescript-api-export/*.json— uneditedaspire sdk exportoutput forAspire.HostingandAspire.Hosting.Redistsc --noEmit --strictwithskipLibCheckoffThe fixtures are deliberately raw CLI output, not hand-tidied — if the producer drifts, these tests are what catches it. That already paid off once: the augmentation ownership test here caught
addRedisshipping asinterface:DistributedApplicationBuilderowned byAspire.Hosting.Redis, which collides with core's item ID. Fixed on the producer side.Still to come on this branch
update-ts-api.tsontoaspire sdk exportand deleteAtsJsonGeneratorgenerate-twoslash-types.tsto validation + dedupe + writenormalize-generated-api-data.tsKeeping it a draft until microsoft/aspire#19032 is in and there's a CLI on a feed CI can restore — the refresh workflow can't run against a
sdk exportthat isn't published yet.Testing
328/328 unit tests, eslint clean.