Skip to content

arm-resource-operation-response

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

[RPC 008]: PUT, GET, PATCH & LIST must return the same resource schema.

PUT, GET, PATCH & LIST must return the same resource schema. Operations on a resource such as read, create, update, and list must all return the resource type itself (or a collection of the resource type for list operations).

  • Area: API

The resource operation returns a response schema that violates the RPC contract.

This rule corresponds to the LintDiff rule PutGetPatchResponseSchema (the TypeSpec rule also covers list).

@armResourceOperations
interface FooResources {
// Returns BarResource instead of FooResource
@get
@armResourceRead(FooResource)
get(...ResourceInstanceParameters<FooResource>): ArmResponse<BarResource> | ErrorResponse;
}
@armResourceOperations
interface FooResources {
@get
@armResourceRead(FooResource)
get(...ResourceInstanceParameters<FooResource>): ArmResponse<FooResource> | ErrorResponse;
}

Suppress only when required to match an existing API; otherwise use the standard operation templates and do not override the response parameter.