Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.69k stars 5.12k forks source link

[BUG] operation Certificates_CreateOrUpdate returns response with status code 202 which constitutes an error by swagger #27962

Open ChenxiJiang333 opened 8 months ago

ChenxiJiang333 commented 8 months ago

API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/web/resource-manager/Microsoft.Web/stable/2023-01-01/Certificates.json#L188

API Spec version

2023-01-01

Describe the bug

When calling operation Certificates_CreateOrUpdate, we get response with status code 202, yet by this swagger definition, status code except 200 would raise HttpResponseError in generated sdk, which would cause confusion from customers.

Expected behavior

update the parameter responses like sample below to avoid error raised with status code 202: image

Actual behavior

call Certificates_CreateOrUpdate with sdk generated by this swagger would raise HttpResponseError though the command would be successfully processed.

Reproduction Steps

call Certificates_CreateOrUpdate and receive the response with status code 202, below is the full log:

2024-02-28 14:09:31,161 - azure.core.pipeline.policies._universal - DEBUG - Request URL: 'https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup/providers/Microsoft.Web/certificates/test?api-version=2023-01-01'
Request method: 'PUT'
Request headers:
    'Content-Type': 'application/json'
    'Content-Length': '243'
    'Accept': 'application/json'
    'x-ms-client-request-id': 'ef1896cf-d5ff-11ee-b62e-a8b13b79b46f'
    'User-Agent': 'azsdk-python-azure-mgmt-web/7.2.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)'
    'Authorization': 'REDACTED'
Request body:
{"location": "eastus", "properties": {"serverFarmId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup/providers/Microsoft.Web/serverfarms/appplanforsdkissue", "canonicalName": "appforsdkissue.azurewebsites.net"}}
2024-02-28 14:09:31,161 - azure.core.pipeline.policies.http_logging_policy - INFO - Request URL: 'https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup/providers/Microsoft.Web/certificates/test?api-version=REDACTED'
Request method: 'PUT'
Request headers:
    'Content-Type': 'application/json'
    'Content-Length': '243'
    'Accept': 'application/json'
    'x-ms-client-request-id': 'ef1896cf-d5ff-11ee-b62e-a8b13b79b46f'
    'User-Agent': 'azsdk-python-azure-mgmt-web/7.2.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)'
    'Authorization': 'REDACTED'
A body is sent with the request
2024-02-28 14:09:31,161 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): management.azure.com:443
2024-02-28 14:09:35,114 - urllib3.connectionpool - DEBUG - https://management.azure.com:443 "PUT /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup/providers/Microsoft.Web/certificates/test?api-version=2023-01-01 HTTP/1.1" 202 0
2024-02-28 14:09:35,114 - azure.core.pipeline.policies.http_logging_policy - INFO - Response status: 202
Response headers:
    'Cache-Control': 'no-cache'
    'Pragma': 'no-cache'
    'Expires': '-1'
    'ETag': '"1DA6A0BDEA6AA60"'
    'Location': 'REDACTED'
    'Retry-After': '15'
    'Strict-Transport-Security': 'REDACTED'
    'X-AspNet-Version': 'REDACTED'
    'X-Powered-By': 'REDACTED'
    'x-ms-ratelimit-remaining-subscription-writes': '1199'
    'x-ms-request-id': '52a89be6-15ed-4e23-bd7c-ef539f56ccbb'
    'x-ms-correlation-request-id': 'REDACTED'
    'x-ms-routing-request-id': 'REDACTED'
    'X-Content-Type-Options': 'REDACTED'
    'X-Cache': 'REDACTED'
    'X-MSEdge-Ref': 'REDACTED'
    'Date': 'Wed, 28 Feb 2024 06:09:35 GMT'
    'Content-Length': '0'
2024-02-28 14:09:35,114 - azure.core.pipeline.policies._universal - DEBUG - Response status: '202'
Response headers:
    'Cache-Control': 'no-cache'
    'Pragma': 'no-cache'
    'Expires': '-1'
    'ETag': '"1DA6A0BDEA6AA60"'
    'Location': 'https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup/providers/Microsoft.Web/certificates/test/operationresults/7a1acb56-e66e-4b18-8071-7dc88fb58790?api-version=2023-01-01&t=638446973754031722&c=MIIHAD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BRtnBNY431tr6872Si1uhnA9Q0oY_Loy1TELqVVHSnZv5Ak_tfVj8WfIk_tPErWJFKYSyH5rm8Oib-ESxwUgReD_HF9MnY14bWX17k0lKxbWDXBozqanPn8qTmnfF9QP-lqUSWCaCx8-p8Ko_YAwLYsD8uPcZogm5XP6QN4UM88O0WhW2SbtydDRtmuU41k0j2byj3C2lK-JwND1w0CfKV6HlCFm_yKAdbmJUK50Y8Mkh2ebZhN0HOcoGcebh1hrMvD1lL1A&s=UevtJjg7FColAsrBu70drEex1Zmdcg5FihvsWI1RVXLTA0V_bGmDyneiQoDG2-9F8xO_9yfm6c9_X0A0GxM8PnGUMX_w4Y8osb0cPxHwSilCTK5uJeVMhYf4HRj5rfXV2iZ28LDzTKJvWq6WkiK8NrsghERRdM38TMGAUfvj8NrSQOsqXMcxSD3fsbhADti3X8270DQ2Lond0vinG7_WGrlf5dwKOZOvrSBKsQ7e29AAoE_FDFeGz_81IkyggLTsX4vfpg8L2AaFcOZ6WoQkoAD1nQrCx4-lVonhQTzmBLpxVKl8P2UBPogVI3y7lfdyJn4s_tkvqaw-1d4MRBt4tQ&h=oZw4ZqGvtJ7aYa0meoLbzZrrkC2LJsvx7OBS0ALmdac'
    'Retry-After': '15'
    'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
    'X-AspNet-Version': '4.0.30319'
    'X-Powered-By': 'ASP.NET'
    'x-ms-ratelimit-remaining-subscription-writes': '1199'
    'x-ms-request-id': '52a89be6-15ed-4e23-bd7c-ef539f56ccbb'
    'x-ms-correlation-request-id': '52a89be6-15ed-4e23-bd7c-ef539f56ccbb'
    'x-ms-routing-request-id': 'JAPANEAST:20240228T060935Z:52a89be6-15ed-4e23-bd7c-ef539f56ccbb'
    'X-Content-Type-Options': 'nosniff'
    'X-Cache': 'CONFIG_NOCACHE'
    'X-MSEdge-Ref': 'Ref A: A2C5DD0B6948444497E86B98CE56E10D Ref B: TYO01EDGE1716 Ref C: 2024-02-28T06:09:31Z'
    'Date': 'Wed, 28 Feb 2024 06:09:35 GMT'
    'Content-Length': '0'
Response content:

Environment

No response

microsoft-github-policy-service[bot] commented 8 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.