Skip to content

arm-put-operation-response-codes

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

Ensure put operations have the appropriate status codes.

Put operations should use the ArmResourceCreateOrReplaceAsync or ArmResourceCreateOrReplaceSync template. They must have 200, 201, default and no other responses.

  • Area: API

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

This rule corresponds to the LintDiff rule PutResponseCodes.

@armResourceOperations
interface Employees {
@armResourceCreateOrUpdate(Employee)
createOrUpdate(...ApiVersionParameter): {
@statusCode _: 200;
result: boolean;
};
}
@armResourceOperations
interface Employees {
createOrUpdate is ArmResourceCreateOrReplaceAsync<Employee>;
}

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