[Bug]: LongRunningResourceCreateWithServiceProvidedName returns a response without Operation-Location header
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 90
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 156
Description
### Describe the bug
When creating a new resource using the standard action `LongRunningResourceCreateWithServiceProvidedName` I receive a warning due to the absence of an `Operation-Location` header in the return response.
When compiling this snippet:
```typescript
interface Widgets {
/** Get status of a Widget operation. This operation return status in status code. No response body is returned. */
getWidgetOperationStatus is Operations.GetResourceOperationStatus<
Widget,
never
>;
/** Delete a Widget asynchronously. */
@pollingOperation(Widgets.getWidgetOperationStatus)
createWidget is Operations.LongRunningResourceCreateWithServiceProvidedName;
}
```
The following warning is emitted:
```
warning @azure-tools/typespec-azure-core/polling-operation-no-ref-or-link: An operation decorated with '@pollingOperation' must either return a response with an 'Operation-Location' header that will contain a runtime link to the polling operation, or specify parameters and return type properties to map into the polling operation parameters. A map into polling operation parameters can be created using the '@pollingOperationParameter' decorator
```
### Reproduction
See this [playground](https://azure.github.io/typespec-azure/playground/?c=aW1wb3J0ICJAdHlwZXNwZWMvcmVzdCI7DQrSGnZlcnNpb25pbmfNIGF6dXJlLXRvb2xzL8gsLWF1dG%2FRStYqxRVjb3JlxCwNCnVzaW5nIEh0dHA7yA1SZXN0yQ1W6QCGyRNBxEMuQ29yZdMTLlRyYWl0c8VcQHNlcnZpY2UoI3sgdGl0bGU6ICJEZW1vIMcYIiB9KQ0KQHVzZURlcGVuZGVuY3koy0vHfHMudjFfMF9QcmV2aWV3XzIpDQpuYW1lc3BhY2UgQXN5bmNEZWxldGXEW8V4YWxpYXMgU8Zl5gCQID0gU3Vw5AEZc1JlcGVhdGFibGVSZXF1ZXN0cyAmDQogySBDb25kaXRpb25hbNchbGllbnTHHElky3NPcGVyYcQ7xHDrAMlSZXNvdXJjZcogPO0Anj7FRC8qKiBBIHdpZGdldC4gKi8NCkByxzkoIsYXcyIpDQptb2RlbCBXxREge%2BQAmsQ6VGhlxzwgSUTGPyAgQGtlecg8SWTEPSAgQHZpc2liaWxpdHkoTGlmZWN5Y2zkAKNhZMUfaWQ6IHN0cuYB8X3kAJhpbnRlcmbkAW3GdHPKdUdldCBzdGF0dXMgb2YgYcchIG%2FoAOguIFRoaXPKECByZXR1cm7INGnJCmNvZGUuIE5vIHJlc3BvbnNlIGJvZHkgaXPHMmVk6ADTZ2V0xmbpAU1Tx03sAYAuR2V08QF2xik8xEYg5wCrLMYNbmV2ZXLEC%2BYBiuYA3eYCVuoA1mHkAmtocm9ub3VzbHnpAWNwb2xsaW5nyWYoxi9zLvgAquUBZ2NyZWF0Zcda7gC7TG9uZ1J1buQDdOgAw0PHLnRo5wI4UHJvdmlkZWROYW1lPMZG5AC7fQ0K&e=%40azure-tools%2Ftypespec-autorest&options=%7B%7D).
### Checklist
- [x] Follow our [Code of Conduct](https://github.com/azure/typespec-azure/blob/main/CODE_OF_CONDUCT.md)
- [x] Check that this issue is about the Azure libraries for typespec. For bug in the typespec language or core libraries file it in the [TypeSpec repo](https://github.com/Microsoft/TypeSpec/issues/new/choose)
- [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Contributor guide
Research direction
No repository file or test is named. Start with the linked playground and trace the TypeScript implementation of LongRunningResourceCreateWithServiceProvidedName and polling-operation-no-ref; done means the reproduced operation no longer emits the warning and its response provides the expected polling linkage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100