From c125f2cd914346ebfc911d362a03d4c77b592d09 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 12 Mar 2024 15:33:20 -0700 Subject: [PATCH 1/3] fixing missing Retry-After in DeleteLro --- .../reference/data-types.md | 34 +++++++++---------- .../lib/responses.tsp | 23 +++++++++---- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index 4b964becbc..3dee2d81bc 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -44,21 +44,21 @@ model Azure.ResourceManager.ArmAcceptedLroResponse ### `ArmAcceptedResponse` {#Azure.ResourceManager.ArmAcceptedResponse} ```typespec -model Azure.ResourceManager.ArmAcceptedResponse +model Azure.ResourceManager.ArmAcceptedResponse ``` #### Template Parameters -| Name | Description | -| ------- | ---------------------------------------------------------------------------------- | -| Message | The description of the response status (defaults to `Resource operation accepted`) | +| Name | Description | +| ------------ | ---------------------------------------------------------------------------------- | +| Message | The description of the response status (defaults to `Resource operation accepted`) | +| ExtraHeaders | Additional headers in the response. Default includes Retry-After header | #### Properties -| Name | Type | Description | -| ----------- | ------- | -------------------------------------------------------------------------------------------------------- | -| statusCode | `202` | The status code. | -| retryAfter? | `int32` | The Retry-After header can indicate how long the client should wait before polling the operation status. | +| Name | Type | Description | +| ---------- | ----- | ---------------- | +| statusCode | `202` | The status code. | ### `ArmAsyncOperationHeader` {#Azure.ResourceManager.ArmAsyncOperationHeader} @@ -110,22 +110,22 @@ model Azure.ResourceManager.ArmCombinedLroHeaders +model Azure.ResourceManager.ArmCreatedResponse ``` #### Template Parameters -| Name | Description | -| ------------ | --------------------------------- | -| ResponseBody | The contents of the response body | +| Name | Description | +| ------------ | ----------------------------------------------------------------------- | +| ResponseBody | The contents of the response body | +| ExtraHeaders | Additional headers in the response. Default includes Retry-After header | #### Properties -| Name | Type | Description | -| ----------- | -------------- | -------------------------------------------------------------------------------------------------------- | -| statusCode | `201` | The status code. | -| retryAfter? | `int32` | The Retry-After header can indicate how long the client should wait before polling the operation status. | -| body | `ResponseBody` | The body type of the operation request or response. | +| Name | Type | Description | +| ---------- | -------------- | --------------------------------------------------- | +| statusCode | `201` | The status code. | +| body | `ResponseBody` | The body type of the operation request or response. | ### `ArmDeleteAcceptedLroResponse` {#Azure.ResourceManager.ArmDeleteAcceptedLroResponse} diff --git a/packages/typespec-azure-resource-manager/lib/responses.tsp b/packages/typespec-azure-resource-manager/lib/responses.tsp index a3ab53cb5e..9a749cf2d1 100644 --- a/packages/typespec-azure-resource-manager/lib/responses.tsp +++ b/packages/typespec-azure-resource-manager/lib/responses.tsp @@ -19,11 +19,15 @@ model ArmResponse { /** * The Azure Resource Manager 201 response for a resource * @template ResponseBody The contents of the response body + * @template ExtraHeaders Additional headers in the response. Default includes Retry-After header */ @doc("Azure create operation completed successfully.") -model ArmCreatedResponse { +model ArmCreatedResponse< + ResponseBody, + ExtraHeaders extends TypeSpec.Reflection.Model = Azure.Core.Foundations.RetryAfterHeader +> { ...CreatedResponse; - ...Azure.Core.Foundations.RetryAfterHeader; + ...ExtraHeaders; ...Body; } @@ -39,7 +43,8 @@ model ArmDeletedResponse { * @dev The response for asynchronous Azure Resource Manager delete ACCEPTED * @template LroHeaders Optional. Allows overriding the Lro headers returned in the response. */ -model ArmDeleteAcceptedLroResponse +model ArmDeleteAcceptedLroResponse is ArmAcceptedLroResponse<"Resource deletion accepted.", LroHeaders>; /** @@ -50,11 +55,15 @@ model ArmDeleteAcceptedResponse is ArmAcceptedResponse<"Resource deletion accept /** * @dev The standard ACCEPTED response * @template Message The description of the response status (defaults to `Resource operation accepted`) + * @template ExtraHeaders Additional headers in the response. Default includes Retry-After header */ @doc(Message) -model ArmAcceptedResponse { +model ArmAcceptedResponse< + Message extends valueof string = "Resource operation accepted.", + ExtraHeaders extends TypeSpec.Reflection.Model = Azure.Core.Foundations.RetryAfterHeader +> { ...AcceptedResponse; - ...Azure.Core.Foundations.RetryAfterHeader; + ...ExtraHeaders; } /** @@ -65,8 +74,8 @@ model ArmAcceptedResponse { ...AcceptedResponse; ...LroHeaders; From bcc07e824776e0368ecd30f8823ee443e6810df3 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 12 Mar 2024 22:21:18 -0700 Subject: [PATCH 2/3] Fixing missing Retry-After in DeleteLro & Adjust the default order to Lexical --- .../typespec-autorest/openapi.json | 40 ++++++------ .../2021-10-01-preview/openapi.json | 16 ++--- .../typespec-autorest/openapi.json | 8 +-- .../typespec-autorest/openapi.json | 8 +-- .../typespec-autorest/openapi.json | 8 +-- .../typespec-autorest/openapi.json | 8 +-- .../typespec-autorest/openapi.json | 8 +-- .../2021-06-13-preview/openapi.json | 16 ++--- .../2022-04-30-preview/openapi.json | 16 ++--- .../typespec-autorest/openapi.json | 16 ++--- .../typespec-autorest/openapi.json | 8 +-- .../typespec-autorest/openapi.json | 8 +-- .../typespec-autorest/openapi.json | 16 ++--- .../typespec-autorest/openapi.json | 40 ++++++------ .../typespec-autorest/openapi.json | 64 +++++++++---------- .../2023-08-01-preview/openapi.json | 8 +-- .../2023-11-01-preview/openapi.json | 8 +-- .../typespec-autorest/openapi.json | 8 +-- .../typespec-autorest/openapi.json | 32 +++++----- .../typespec-autorest/openapi.json | 40 ++++++------ .../lib/operations.tsp | 56 ++++++++-------- .../lib/responses.tsp | 4 +- 22 files changed, 220 insertions(+), 216 deletions(-) diff --git a/packages/samples/test/output/azure/resource-manager/arm-library/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/arm-library/@azure-tools/typespec-autorest/openapi.json index 8e7a96bd90..ece4695a69 100644 --- a/packages/samples/test/output/azure/resource-manager/arm-library/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/arm-library/@azure-tools/typespec-autorest/openapi.json @@ -267,14 +267,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -516,14 +516,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -866,14 +866,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1333,14 +1333,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1561,14 +1561,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/arm-scenarios/nobody-action/@azure-tools/typespec-autorest/2021-10-01-preview/openapi.json b/packages/samples/test/output/azure/resource-manager/arm-scenarios/nobody-action/@azure-tools/typespec-autorest/2021-10-01-preview/openapi.json index 904f9a56c4..a4ab9e6e92 100644 --- a/packages/samples/test/output/azure/resource-manager/arm-scenarios/nobody-action/@azure-tools/typespec-autorest/2021-10-01-preview/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/arm-scenarios/nobody-action/@azure-tools/typespec-autorest/2021-10-01-preview/openapi.json @@ -416,14 +416,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -473,14 +473,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/codesigning/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/codesigning/@azure-tools/typespec-autorest/openapi.json index 102b4e3c7a..f7401cff3d 100644 --- a/packages/samples/test/output/azure/resource-manager/codesigning/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/codesigning/@azure-tools/typespec-autorest/openapi.json @@ -340,14 +340,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/contoso/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/contoso/@azure-tools/typespec-autorest/openapi.json index 27de199ae0..4c23b612cd 100644 --- a/packages/samples/test/output/azure/resource-manager/contoso/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/contoso/@azure-tools/typespec-autorest/openapi.json @@ -337,14 +337,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/csharpattributetest/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/csharpattributetest/@azure-tools/typespec-autorest/openapi.json index 2c34bfd5de..ead904b37e 100644 --- a/packages/samples/test/output/azure/resource-manager/csharpattributetest/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/csharpattributetest/@azure-tools/typespec-autorest/openapi.json @@ -332,14 +332,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/customer-managed-keys/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/customer-managed-keys/@azure-tools/typespec-autorest/openapi.json index bf3d57bc21..39271ca1fc 100644 --- a/packages/samples/test/output/azure/resource-manager/customer-managed-keys/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/customer-managed-keys/@azure-tools/typespec-autorest/openapi.json @@ -330,14 +330,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/discriminatortest/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/discriminatortest/@azure-tools/typespec-autorest/openapi.json index 3451cfde71..b66833f9bd 100644 --- a/packages/samples/test/output/azure/resource-manager/discriminatortest/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/discriminatortest/@azure-tools/typespec-autorest/openapi.json @@ -337,14 +337,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/dynatrace/@azure-tools/typespec-autorest/2021-06-13-preview/openapi.json b/packages/samples/test/output/azure/resource-manager/dynatrace/@azure-tools/typespec-autorest/2021-06-13-preview/openapi.json index 0fab89d28e..5d43f17dfd 100644 --- a/packages/samples/test/output/azure/resource-manager/dynatrace/@azure-tools/typespec-autorest/2021-06-13-preview/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/dynatrace/@azure-tools/typespec-autorest/2021-06-13-preview/openapi.json @@ -415,14 +415,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1033,14 +1033,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/dynatrace/@azure-tools/typespec-autorest/2022-04-30-preview/openapi.json b/packages/samples/test/output/azure/resource-manager/dynatrace/@azure-tools/typespec-autorest/2022-04-30-preview/openapi.json index 045e37a5fd..8281ce3f09 100644 --- a/packages/samples/test/output/azure/resource-manager/dynatrace/@azure-tools/typespec-autorest/2022-04-30-preview/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/dynatrace/@azure-tools/typespec-autorest/2022-04-30-preview/openapi.json @@ -415,14 +415,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1033,14 +1033,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/envelopetest/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/envelopetest/@azure-tools/typespec-autorest/openapi.json index 8d6e901aa2..b8506e2c5b 100644 --- a/packages/samples/test/output/azure/resource-manager/envelopetest/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/envelopetest/@azure-tools/typespec-autorest/openapi.json @@ -369,14 +369,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -617,14 +617,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/liftr.confluent/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/liftr.confluent/@azure-tools/typespec-autorest/openapi.json index 401039b810..8be2e5eca8 100644 --- a/packages/samples/test/output/azure/resource-manager/liftr.confluent/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/liftr.confluent/@azure-tools/typespec-autorest/openapi.json @@ -409,14 +409,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/liftr.frs/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/liftr.frs/@azure-tools/typespec-autorest/openapi.json index f6fd413f2d..425a6cbb08 100644 --- a/packages/samples/test/output/azure/resource-manager/liftr.frs/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/liftr.frs/@azure-tools/typespec-autorest/openapi.json @@ -332,14 +332,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/liftr.playfab/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/liftr.playfab/@azure-tools/typespec-autorest/openapi.json index 1fabd48baf..aa27c9f54d 100644 --- a/packages/samples/test/output/azure/resource-manager/liftr.playfab/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/liftr.playfab/@azure-tools/typespec-autorest/openapi.json @@ -369,14 +369,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -617,14 +617,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/logz/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/logz/@azure-tools/typespec-autorest/openapi.json index f8cd277816..7a2cd0aef3 100644 --- a/packages/samples/test/output/azure/resource-manager/logz/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/logz/@azure-tools/typespec-autorest/openapi.json @@ -344,14 +344,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -572,14 +572,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -828,14 +828,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1155,14 +1155,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1383,14 +1383,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/operationsTest/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/operationsTest/@azure-tools/typespec-autorest/openapi.json index 3d22391d70..70cfc8dfb2 100644 --- a/packages/samples/test/output/azure/resource-manager/operationsTest/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/operationsTest/@azure-tools/typespec-autorest/openapi.json @@ -734,14 +734,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -950,14 +950,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1648,14 +1648,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1852,14 +1852,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -2397,14 +2397,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -2475,14 +2475,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -3397,14 +3397,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -3625,14 +3625,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/private-links/@azure-tools/typespec-autorest/2023-08-01-preview/openapi.json b/packages/samples/test/output/azure/resource-manager/private-links/@azure-tools/typespec-autorest/2023-08-01-preview/openapi.json index 53f16522b6..0d68dd2161 100644 --- a/packages/samples/test/output/azure/resource-manager/private-links/@azure-tools/typespec-autorest/2023-08-01-preview/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/private-links/@azure-tools/typespec-autorest/2023-08-01-preview/openapi.json @@ -338,14 +338,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/private-links/@azure-tools/typespec-autorest/2023-11-01-preview/openapi.json b/packages/samples/test/output/azure/resource-manager/private-links/@azure-tools/typespec-autorest/2023-11-01-preview/openapi.json index 7fc97b75af..00e4acdf5d 100644 --- a/packages/samples/test/output/azure/resource-manager/private-links/@azure-tools/typespec-autorest/2023-11-01-preview/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/private-links/@azure-tools/typespec-autorest/2023-11-01-preview/openapi.json @@ -338,14 +338,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/servicelinker/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/servicelinker/@azure-tools/typespec-autorest/openapi.json index 398d6584ee..1414db822c 100644 --- a/packages/samples/test/output/azure/resource-manager/servicelinker/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/servicelinker/@azure-tools/typespec-autorest/openapi.json @@ -252,14 +252,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/tagsUpdateTest/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/tagsUpdateTest/@azure-tools/typespec-autorest/openapi.json index e06c6b5e6d..ea0378d2db 100644 --- a/packages/samples/test/output/azure/resource-manager/tagsUpdateTest/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/tagsUpdateTest/@azure-tools/typespec-autorest/openapi.json @@ -425,14 +425,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -705,14 +705,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -973,14 +973,14 @@ "202": { "description": "Resource update request accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1038,14 +1038,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/samples/test/output/azure/resource-manager/tenantResource/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/tenantResource/@azure-tools/typespec-autorest/openapi.json index 2d1d3c3848..89d43e099e 100644 --- a/packages/samples/test/output/azure/resource-manager/tenantResource/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/tenantResource/@azure-tools/typespec-autorest/openapi.json @@ -264,14 +264,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -513,14 +513,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -717,14 +717,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1083,14 +1083,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1352,14 +1352,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/typespec-azure-resource-manager/lib/operations.tsp b/packages/typespec-azure-resource-manager/lib/operations.tsp index 04e3797ede..7967069fc5 100644 --- a/packages/typespec-azure-resource-manager/lib/operations.tsp +++ b/packages/typespec-azure-resource-manager/lib/operations.tsp @@ -258,12 +258,12 @@ op ArmTagsPatchAsync< Resource extends ArmResource, Properties extends {} = TagsUpdateModel, BaseParameters = DefaultBaseParameters, - LroHeaders extends TypeSpec.Reflection.Model = Azure.Core.Foundations.RetryAfterHeader & - ArmLroLocationHeader< - Azure.Core.StatusMonitorPollingOptions, - Resource, - string - >, + LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader< + Azure.Core.StatusMonitorPollingOptions, + Resource, + string + > & + Azure.Core.Foundations.RetryAfterHeader, Parameters extends {} = {} > is ArmCustomPatchAsync< Resource, @@ -325,12 +325,12 @@ op ArmCustomPatchAsync< Resource extends ArmResource, PatchModel extends TypeSpec.Reflection.Model = TagsUpdateModel, BaseParameters = DefaultBaseParameters, - LroHeaders extends TypeSpec.Reflection.Model = Azure.Core.Foundations.RetryAfterHeader & - ArmLroLocationHeader< - Azure.Core.StatusMonitorPollingOptions, - Resource, - string - >, + LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader< + Azure.Core.StatusMonitorPollingOptions, + Resource, + string + > & + Azure.Core.Foundations.RetryAfterHeader, Parameters extends {} = {}, Response extends {} = ArmResponse | ArmAcceptedLroResponse< "Resource update request accepted.", @@ -442,8 +442,8 @@ op ArmResourceDeleteAsyncBase< op ArmResourceDeleteAsync< Resource extends ArmResource, BaseParameters = DefaultBaseParameters, - LroHeaders extends TypeSpec.Reflection.Model = Azure.Core.Foundations.RetryAfterHeader & - ArmLroLocationHeader, + LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader & + Azure.Core.Foundations.RetryAfterHeader, Parameters extends {} = {}, Response extends {} = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse, Error extends {} = ErrorResponse @@ -461,8 +461,8 @@ op ArmResourceDeleteAsync< op ArmResourceDeleteWithoutOkAsync< Resource extends ArmResource, BaseParameters = DefaultBaseParameters, - LroHeaders extends TypeSpec.Reflection.Model = Azure.Core.Foundations.RetryAfterHeader & - ArmLroLocationHeader, + LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader & + Azure.Core.Foundations.RetryAfterHeader, Parameters extends {} = {}, Response extends {} = ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse, Error extends {} = ErrorResponse @@ -539,12 +539,12 @@ op ArmResourceActionAsync< Request extends TypeSpec.Reflection.Model | void, Response extends TypeSpec.Reflection.Model | void, BaseParameters extends TypeSpec.Reflection.Model = DefaultBaseParameters, - LroHeaders extends TypeSpec.Reflection.Model = Azure.Core.Foundations.RetryAfterHeader & - ArmLroLocationHeader< - Azure.Core.StatusMonitorPollingOptions, - Response, - string - >, + LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader< + Azure.Core.StatusMonitorPollingOptions, + Response, + string + > & + Azure.Core.Foundations.RetryAfterHeader, Parameters extends {} = {}, Error extends {} = ErrorResponse > is ArmResourceActionAsyncBase< @@ -598,8 +598,8 @@ op ArmResourceActionNoContentAsync< Resource extends ArmResource, Request extends TypeSpec.Reflection.Model | void, BaseParameters extends TypeSpec.Reflection.Model = DefaultBaseParameters, - LroHeaders extends TypeSpec.Reflection.Model = Azure.Core.Foundations.RetryAfterHeader & - ArmLroLocationHeader, + LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader & + Azure.Core.Foundations.RetryAfterHeader, Parameters extends {} = {}, Error extends {} = ErrorResponse > is ArmResourceActionAsyncBase< @@ -627,8 +627,12 @@ op ArmResourceActionNoResponseContentAsync< Resource extends ArmResource, Request extends TypeSpec.Reflection.Model | void, BaseParameters extends TypeSpec.Reflection.Model = DefaultBaseParameters, - LroHeaders extends TypeSpec.Reflection.Model = Azure.Core.Foundations.RetryAfterHeader & - ArmLroLocationHeader, void, string>, + LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader< + Azure.Core.StatusMonitorPollingOptions, + void, + string + > & + Azure.Core.Foundations.RetryAfterHeader, Parameters extends {} = {}, Error extends {} = ErrorResponse > is ArmResourceActionAsyncBase< diff --git a/packages/typespec-azure-resource-manager/lib/responses.tsp b/packages/typespec-azure-resource-manager/lib/responses.tsp index 9a749cf2d1..b326199466 100644 --- a/packages/typespec-azure-resource-manager/lib/responses.tsp +++ b/packages/typespec-azure-resource-manager/lib/responses.tsp @@ -74,8 +74,8 @@ model ArmAcceptedResponse< @doc(Description) model ArmAcceptedLroResponse< Description extends valueof string = "Resource operation accepted.", - LroHeaders extends TypeSpec.Reflection.Model = Azure.Core.Foundations.RetryAfterHeader & - ArmLroLocationHeader + LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader & + Azure.Core.Foundations.RetryAfterHeader > { ...AcceptedResponse; ...LroHeaders; From bf309c0e972c1119805ca47bc589b40b94cb5b4c Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 12 Mar 2024 22:49:20 -0700 Subject: [PATCH 3/3] Add change log --- .chronus/changes/azhang_fixRetryAfter-2024-2-12-22-49-3.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .chronus/changes/azhang_fixRetryAfter-2024-2-12-22-49-3.md diff --git a/.chronus/changes/azhang_fixRetryAfter-2024-2-12-22-49-3.md b/.chronus/changes/azhang_fixRetryAfter-2024-2-12-22-49-3.md new file mode 100644 index 0000000000..659d47f30e --- /dev/null +++ b/.chronus/changes/azhang_fixRetryAfter-2024-2-12-22-49-3.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@azure-tools/typespec-azure-resource-manager" +--- + +Fixing ArmDeleteLroResponse missing Retry-After header \ No newline at end of file