Skip to content

[TCGC] Add legacy LRO operation ID metadata - #5782

Open
iscai-msft wants to merge 1 commit into
Azure:mainfrom
iscai-msft:lro-operation-id-metadata
Open

iscai-msft wants to merge 1 commit into
Azure:mainfrom
iscai-msft:lro-operation-id-metadata

Conversation

@iscai-msft

@iscai-msft iscai-msft commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Add a narrow TCGC compatibility contract for SDKs that preserve operation identity for legacy services where the server-issued ID is available only as a path parameter in the returned status-monitor URI.

@route("/documentModels/{modelId}/analyzeResults/{resultId}")
@get
op getAnalyzeResult(
  @path modelId: string,
  @lroOperationId @path resultId: string,
): AnalyzeOperation;

@pollingOperation(getAnalyzeResult)
op analyze(...): ...;

@lroOperationId marks the exact path parameter on an explicitly linked polling operation. TCGC returns the exact SdkPathParameter together with the exact polling SdkOperationLink, allowing an emitter to expose the URI-derived value through its idiomatic operation or poller API without guessing a path segment.

This metadata does not guide polling. Polling continues to use the complete Operation-Location URI. It is also distinct from a caller-supplied Operation-Id request parameter. Conforming Azure services that model operation identity in their request/response contract do not need this decorator.

This is split from #5677 so that the general @lroStatusMetadata proposal and this legacy compatibility mechanism can be reviewed independently.

Included

  • scoped @lroOperationId on the linked polling operation's @path parameter;
  • exact SdkLroOperationIdMetadata link and path-parameter references;
  • linked polling-operation preservation through Azure.Core and TCGC metadata;
  • validation for non-path targets, duplicate selections, and unusable polling links;
  • focused TCGC and Azure.Core coverage;
  • a Document Intelligence-shaped Spector scenario whose status body intentionally omits the URI-derived result ID.

Validation

  • dependency-inclusive TCGC/Azure.Core build;
  • full TCGC suite: 1,729 passed, 2 skipped;
  • full Azure.Core suite: 491 passed, 2 skipped;
  • all 81 full / 61 scenario definitions generated successfully;
  • all 61 Spector mock APIs validated;
  • repository formatting and lint;
  • git diff --check.

This PR supersedes the Document Intelligence/operation-ID portion of #5740; the Content Understanding/status-metadata portion is included in #5677.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d18612ec-bd77-4fdd-86d0-467051688ac6
@microsoft-github-policy-service microsoft-github-policy-service Bot added lib:azure-core Issues for @azure-tools/typespec-azure-core library lib:tcgc Issues for @azure-tools/typespec-client-generator-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 Oct 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

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

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

Add scoped @lroOperationId metadata for legacy services that expose server-issued operation identity only through a linked status-monitor URI, plus a Document Intelligence-shaped Spector scenario.

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

Add scoped @lroOperationId metadata for legacy services that expose server-issued operation identity only through a linked status-monitor URI, plus a Document Intelligence-shaped Spector scenario.

@azure-tools/azure-http-specs - feature ✏️

Add scoped @lroOperationId metadata for legacy services that expose server-issued operation identity only through a linked status-monitor URI, plus a Document Intelligence-shaped Spector scenario.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Package size report

2 packages changed size, +3.94 KB (+0.0%) packed overall.

Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-client-generator-core 249.93 KB → 252.40 KB +2.47 KB (+1.0%) 🔴 1.33 MB → 1.34 MB +13.81 KB (+1.0%) 🔴
@azure-tools/azure-http-specs 144.06 KB → 145.28 KB +1.22 KB (+0.8%) 🔴 1.21 MB → 1.21 MB +6.03 KB (+0.5%)
12 package(s) with no notable change
Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-azure-core 136.55 KB → 136.79 KB +251 B (+0.2%) 733.30 KB → 734.49 KB +1.19 KB (+0.2%)
@azure-tools/typespec-ts 530.76 KB → 530.76 KB -1 B (-0.0%) 2.67 MB → 2.67 MB —
@azure-tools/typespec-autorest 87.87 KB → 87.87 KB — 424.17 KB → 424.17 KB —
@azure-tools/typespec-autorest-canonical 7.42 KB → 7.42 KB — 26.00 KB → 26.00 KB —
@azure-tools/typespec-azure-examples 80.15 KB → 80.15 KB — 383.36 KB → 383.36 KB —
@azure-tools/typespec-azure-portal-core 36.26 KB → 36.26 KB — 242.62 KB → 242.62 KB —
@azure-tools/typespec-azure-resource-manager 187.63 KB → 187.63 KB — 1.13 MB → 1.13 MB —
@azure-tools/typespec-azure-rulesets 5.60 KB → 5.60 KB — 34.59 KB → 34.59 KB —
@azure-tools/typespec-go 263.76 KB → 263.76 KB — 1.35 MB → 1.35 MB —
@azure-tools/typespec-java 20.22 MB → 20.22 MB — 22.51 MB → 22.51 MB —
@azure-tools/typespec-metadata 15.91 KB → 15.91 KB — 62.26 KB → 62.26 KB —
@azure-tools/typespec-python 42.58 KB → 42.58 KB — 166.02 KB → 166.02 KB —

Packed = gzipped .tgz published to npm. Unpacked = total extracted size. 🆕 added, 🗑️ removed. Packages from the core/ submodule are not included.
🔴 grew · 🟢 shrank — only changes of at least 512 B and 0.5% are marked.

@pkg-pr-new

pkg-pr-new Bot commented Oct 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/azure-http-specs@5782
npm i https://pkg.pr.new/@azure-tools/typespec-azure-core@5782
npm i https://pkg.pr.new/@azure-tools/typespec-client-generator-core@5782

commit: b64a0ad

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

You can try these changes here

🛝 Playground 🌐 Website

@tadelesh Chenjie Shi (tadelesh) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The operation ID could be in response body, request header, response header. Do you think we should support annotating all these cases and provide a more complete operation ID support in TCGC's code model?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: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.

2 participants