ITADN

[Bug]: ArmResourceActionNoResponseContentAsync Not Generating Swagger with 204 Status Code

#4653Closedbennerv 创建于 2026-06-17
bugneeds-area
B
bennervcommented
### Describe the bug The [post-response-codes.md](https://github.com/Azure/azure-openapi-validator/blob/main/docs/post-response-codes.md) states that if you return an Async LRO action without any schema, it should generate a 204 status code in the results. That's not being done when you use the `ArmResourceActionNoResponseContentAsync ` type. Note that there's inconsistency among the RPC. https://github.com/cloud-and-ai-microsoft/resource-provider-contract/blob/master/v1.0/proxy-api-reference.md says > An asynchronous POST operation must specify 202 [Accepted] to indicate successful acceptance of the API. It should additionaly specify status code 200 (OK) with a response schema indicating the schema of the final response if the final response is expected to have one. If the final response is expected to not have any content, specifying only 202 is sufficient. But the rule is nevertheless being enforced. ### Reproduction [Reproduction here](https://azure.github.io/typespec-azure/playground/?e=%40azure-tools%2Ftypespec-autorest&v=file-output&c=aW1wb3J0ICJAdHlwZXNwZWMvdmVyc2lvbmluZyI7DQrJIGF6dXJlLXRvb2xzL8gsLcYVcmVzb3VyY2UtbWFuYWdlcsQ4DQp1c2luZyBUeXBlU3BlYy5WyVc7yBxBxD4uUsc%2BTcY9xTxAYXJtUHJvdmlkZXJOYW1lc3BhY2UNCkBzZXJ2aWNlKCN7IHRpdGxlOiAiVGVzdCBTxhgiIH0pDQpA5wDCZWQoxB3IenMpDQpuyEwgxBrFa2ludGVyZsQTT3BlcmF0xCogZXh0ZW5kc%2FYAoi7LKXt9xERlbnVtIMhnIHsNCiAg5ADCQ29tbW9u5AECc8cdKNZRyynpAK4udjYpxEl2MjAyNF8wMV8wMTogIsQNLTAxLTAxIiwNCsV9bW9kZWwgV2lkZ2V0IGlzIFRyYWNrZWTIZDzGGlByb3BlcnRpZXM%2B5gChLi7pAIfkAWJQYXJhbWV0ZXLHMD4701%2FKRcZEQHZpc2liaWxpdHkoTGlmZWN5Y2zkAN5hZOUAu3DkAcLnAfVTdGF0ZT86IMh05QHezBzIcOQBOcgl6gFpKOYAgSnsAbDGE%2BcAi%2BcA%2FUHKPeQAh%2BsAzSAgY3JlYXRlT3JVcGRhdGXPLkPHHVJlcGxhY2VBc3luY80%2BZGVsZdE2RMUVV2l0aG91dE9r0DbFOG9Tb21ldGjkAvHOPUFj5ADbTm9SZXNwb25zZUNvbnRlbnTMRSwgdm9pZOcBjA%3D%3D&options=%7B%7D&vs=%7B%7D) ```json "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Test/widgets/{widgetName}/doSomething": { "post": { "operationId": "Widgets_DoSomething", "tags": [ "Widgets" ], "description": "A long-running resource action.", "parameters": [ { "$ref": "../../../../common-types/resource-management/v6/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../common-types/resource-management/v6/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../common-types/resource-management/v6/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", "in": "path", "description": "The name of the Widget", "required": true, "type": "string", "pattern": "^[a-zA-Z0-9-]{3,24}$" } ], "responses": { "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." } } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "../../../../common-types/resource-management/v6/types.json#/definitions/ErrorResponse" } } }, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-long-running-operation": true } ``` ### 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.
关闭于 2026-06-17 1 条评论