Azure / Azure/typespec-azure

[tcgc] Add a decorator for LRO operations to specify what type to return in client method

Open
#1,167 8 comments 0 reactions 0 assignees View on GitHub
bug lib:azure-core
Dominant language
TypeScript
Stars
27
Forks
90
Avg merge
1d 22h
Merged PRs (30d)
156

Description

**Feature request:**
Add a decorator to specify what response type to return for LROs.

**Context:**
Some services define LROs that return their status monitor schema as the final response of their LRO, this is acceptable behavior in some contexts. See this spec definition approved by the stewardship board: https://github.com/Azure/azure-rest-api-specs/blob/5046b2ea8ec0a7701990de74feee1d357114ca7a/specification/ai/HealthInsights/HealthInsights.RadiologyInsights/route.radiologyinsights.tsp#L25

However, in the sdks we usually try to return the type of the `result` property on the status monitor schema. If all languages align on returning the type of the `result` property as the default behavior, then we should allow service partners to choose if they want the top-level response envelope to be returned instead. A decorator could help with this. In the example above, the difference would be between returning `RadiologyInsightsJob` vs `RadiologyInsightsInferenceResult`.

cc @johanste

Contributor guide

Open the contributing guide

Research direction

Start with the linked route.radiologyinsights.tsp example at the referenced L25 definition, then trace how LRO return types are currently selected in this repository. Define how a decorator would choose between the status-monitor envelope and its result type, and verify the behavior for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.