Skip to content

no-response-body

Id
@azure-tools/typespec-azure-resource-manager/no-response-body

Check that the body is empty for 202 and 204 responses, and not empty for other success (2xx) responses.

This keeps ARM response schemas aligned with how clients interpret long-running or empty success responses versus success responses that return resource data.

  • Area: API

For 202 and 204 status codes (response body should be empty)

Section titled “For 202 and 204 status codes (response body should be empty)”

A response - usually a 202 - carries a body that should be empty.

op walk(): ArmNoContentResponse & {
@body body: string;
};
{
"responses": {
"204": {
"description": "There is no content to send for this request, but the headers may be useful. ",
"schema": {
"type": "string"
}
}
}
}
op walk(): ArmAcceptedResponse;
{
"responses": {
"202": {
"description": "The request has been accepted for processing, but processing has not yet completed."
}
}
}

For other success (2xx) response status codes (response body should not be empty)

Section titled “For other success (2xx) response status codes (response body should not be empty)”
op walk(): CreatedResponse;
{
"responses": {
"201": {
"description": "The request has succeeded and a new resource has been created as a result."
}
}
}
op walk(): ArmCreatedResponse<{
name: string;
}>;
{
"responses": {
"201": {
"description": "Azure create operation completed successfully.",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"required": ["name"]
}
}
}
}

Suppress at will for 202, but never for 204. Use the standard operation and response templates.