[spector] Add a POST long running API whose response type is `bytes`
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 90
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 156
Description
GOAL:
add test case in https://github.com/Azure/typespec-azure/blob/a68aa69f03652b819048638e0eb593478c35f2c6/packages/azure-http-specs/specs/azure/resource-manager/operation-templates/lro.tsp for POST LRO whose response type is `bytes`.
Context:
You could refer to [playground](https://azure.github.io/typespec-azure/playground/?options=%7B%22linterRuleSet%22%3A%7B%22extends%22%3A%5B%22%40azure-tools%2Ftypespec-azure-rulesets%2Fresource-manager%22%5D%7D%7D&vs=%7B%7D&c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7CskZYXp1cmUtdG9vbHMvyCUtxhVjb3Jl3yvIK3Jlc291cmNlLW1hbmFnZXIiOwoKdXNpbmcgSHR0cDvHDFJlc3TIDFZlcnNpb25pbmfIEkHESi5Db3JlzhJSx1xNxls7CgpAYXJtUHJvdmlkZXJOYW1lc3BhY2UKQHNlcnZpY2UoI3sgdGl0bGU6ICJCaW5hcnkgRXjlAMNTxiEiIH0pCkB25gCBZWQo5wCLcykKbshNIENvbnRvc28uxkHGQDsKCmVudW3oALtzIHsKICDkAIxDb21tb25U5AETxxwo9QC7LsspLshGLnY1KQogIGAyMDI0LTA2LTAxYCwKfQoKbW9kZWznALpSZXF1ZXN0xXHGUklkOiBzdHLlAT99CgovLyBMUk86IFBPU1QgcmV0dXJucyAyMDIsIGZpbmFsIHJlc3VsdCBpcyBieXRlcwpAYWN05ACnImXFYCIpCm9wIMYM5wEzaXMgQXJt6ADBQcUvQXN5bmM8CiAgLy%2FkAczFGiDkAgogKGZvciBSQkFDLCBldGMu5ADR6AC6xicsyDbmAMlib2R5xTrLKcUaxyhG6AC2cG9uc8hk5QC7xFt7QMVAZGF0YTrmANF9Cj478AEzxnnkAMlUcmFja2VkyBM8e30%2B5QFLLi7pAaLkAkdQYXJhbWV0ZXI8zkM%2BOwp9&e=%40azure-tools%2Ftypespec-autorest) :
```
import "@typespec/http";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
using Http;
using Rest;
using Versioning;
using Azure.Core;
using Azure.ResourceManager;
@armProviderNamespace
@service(#{ title: "Binary Export Service" })
@versioned(Versions)
namespace Contoso.BinaryExport;
enum Versions {
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5)
`2024-06-01`,
}
model ExportRequest {
sourceId: string;
}
// LRO: POST returns 202, final result is bytes
@action("export")
op exportBinary is ArmResourceActionAsync<
// Resource type (for RBAC, etc.)
ExportResource,
// Request body type
ExportRequest,
// Final response type (bytes)
{@body data: bytes}
>;
model ExportResource is TrackedResource<{}> {
...ResourceNameParameter;
}
```
NOTE:
- DO add changelog under `https://github.com/Azure/typespec-azure/tree/main/.chronus/changes`
- For runtime bahavior, since the response type is `bytes`, you could refer to https://github.com/microsoft/typespec/tree/main/packages/http-specs/specs/payload/content-negotiation which contains test case whose response type is also `bytes`.
Contributor guide
Assessment
This issue has not been assessed yet.