Skip to content

Cherry-pick: feat(typespec-metadata): add apiVersion field using TCGC resolution (#5065) - #5087

Closed
iscai-msft wants to merge 1 commit into
release/july-2026from
iscai-msft-cherry-pick-api-version-to-july-2026
Closed

iscai-msft wants to merge 1 commit into
release/july-2026from
iscai-msft-cherry-pick-api-version-to-july-2026

Conversation

@iscai-msft

Copy link
Copy Markdown
Member

Cherry-pick of 6fd24e3 onto release/july-2026.

…5065)

Adds an `apiVersion` field to the `LanguagePackageMetadata` interface in
`packages/typespec-metadata`, resolved via `createSdkContext` from
`@azure-tools/typespec-client-generator-core`.

- **`src/metadata.ts`**: Added `apiVersion?: string` to
`LanguagePackageMetadata` with doc comment explaining possible values
- **`src/emitter.ts`**: Calls `createSdkContext` and resolves
`sdkPackage.metadata.apiVersions` map
- **`src/collector.ts`**: Threads `resolvedApiVersion` through
`collectLanguagePackages` → `buildLanguageMetadata` →
`createLanguageMetadata`
- **`package.json`**: Added
`@azure-tools/typespec-client-generator-core` as `"workspace:^"`
dependency
- **`test/collector.test.ts`**: Added "apiVersion extraction" describe
block with 5 tests

| Map state | Resolved value |
|-----------|---------------|
| size > 1 | `"multiple-versions"` |
| size == 1 | The single value (`"all"` or actual version like
`"2023-10-01"`) |
| empty/undefined | `undefined` |

---------

Co-authored-by: iscai-msft <isabellavcai@gmail.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c95a24d5-2785-44e4-9599-ac2f5cb37a2c
Copilot-Session: 7d63e253-0c42-46ea-88b1-3e0aa1dddebe
Copilot-Session: 75e5e691-2de3-4305-9855-bee4534c6690
Copilot-Session: 4d3f5528-7e0e-4828-ab85-b85ba9dffc5d
@iscai-msft
iscai-msft force-pushed the iscai-msft-cherry-pick-api-version-to-july-2026 branch from e0480a9 to 93b40c1 Compare July 28, 2026 19:25
@azure-sdk-automation

azure-sdk-automation Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

❌ There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • ❌@azure-tools/typespec-autorest
  • ❌@azure-tools/typespec-java

The following packages have already been documented:

  • ✅ @azure-tools/typespec-client-generator-core
  • ✅ @azure-tools/typespec-metadata
Show changes

@azure-tools/typespec-metadata - feature ✏️

Add apiVersion field to LanguagePackageMetadata resolved via TCGC's createSdkContext. Values: "all" when configured for all versions, "multiple-versions" for multi-service configs, the actual resolved version string, or undefined when unavailable. Also adds api-version as a passthrough emitter option.

@azure-tools/typespec-client-generator-core - feature ✏️

add sseMetadata with per-event information for server-sent event (SSE) streams

@pkg-pr-new

pkg-pr-new Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/typespec-autorest@5087
npm i https://pkg.pr.new/@azure-tools/typespec-client-generator-core@5087
npm i https://pkg.pr.new/@azure-tools/typespec-java@5087
npm i https://pkg.pr.new/@azure-tools/typespec-metadata@5087

commit: 93b40c1

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

You can try these changes here

🛝 Playground 🌐 Website

@microsoft-github-policy-service microsoft-github-policy-service Bot added lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library lib:azure-http-specs For issues/prs related to the @azure-tools/typespec-azure-http-specs package meta:website TypeSpec.io updates labels Jul 28, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added lib:azure-core Issues for @azure-tools/typespec-azure-core library emitter:autorest Issues for @azure-tools/typespec-autorest emitter emitter:typescript Issues for @azure-tools/typespec-ts emitter emitter:java Issues for @azure-tools/typespec-java emitter labels Jul 28, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added emitter:java Issues for @azure-tools/typespec-java emitter lib:tcgc Issues for @azure-tools/typespec-client-generator-core library labels Jul 28, 2026
@iscai-msft
iscai-msft force-pushed the iscai-msft-cherry-pick-api-version-to-july-2026 branch from e4d63c4 to 93b40c1 Compare July 28, 2026 19:57
@iscai-msft iscai-msft closed this Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:autorest Issues for @azure-tools/typespec-autorest emitter emitter:java Issues for @azure-tools/typespec-java emitter emitter:typescript Issues for @azure-tools/typespec-ts emitter lib:azure-core Issues for @azure-tools/typespec-azure-core library lib:azure-http-specs For issues/prs related to the @azure-tools/typespec-azure-http-specs package lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library lib:tcgc Issues for @azure-tools/typespec-client-generator-core library meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant