Skip to content

no-response-body

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

ARM operation responses with status code 202 or 204 should not contain a response body. Operation responses with other success (2xx) status codes should contain a response body.

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

Section titled “For 202 and 204 status codes (response body 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"]
}
}
}
}

Impacts the API: a non-empty response is declared where an empty one is expected, usually for 202 responses. Ask the author to use standard operation templates and standard response templates. Suppression is acceptable at will for 202 responses, but never for 204 responses.