Skip to content

arm-delete-operation-response-codes

Id
@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes

Ensure delete operations have the appropriate status codes.

  • Area: API

The delete operation returns response codes that violate the RPC contract.

This rule corresponds to the LintDiff rule DeleteResponseCodes.

Synchronous delete operations should use the ArmResourceDeleteSync template. They must have 200, 204, default and no other responses.

@armResourceOperations
interface Employees {
@armResourceDelete(Employee)
delete(...ApiVersionParameter): {
@statusCode _: 200;
result: boolean;
};
}
@armResourceOperations
interface Employees {
delete is ArmResourceDeleteSync<Employee>;
}

Long-running (LRO) delete operations should use the ArmResourceDeleteWithoutOkAsync template. They must have 202, 204, default, and no other responses.

@armResourceOperations
interface Employees {
delete is ArmResourceDeleteAsync<Employee>;
}
@armResourceOperations
interface Employees {
delete is ArmResourceDeleteWithoutOkAsync<Employee>;
}

Suppress only when required to match an existing API; otherwise use the standard delete operation templates.