Skip to content

arm-resource-operation

Full name
@azure-tools/typespec-azure-resource-manager/arm-resource-operation

Validate that all ARM Resource operations are defined inside an interface, include an api-version parameter, and use the correct decorator for the HTTP verb.

Operations must be inside an interface:

// Operation defined outside of an interface
@armResourceRead(FooResource)
@get
op getFoos(...ApiVersionParameter): FooResource;

Operations must use the correct ARM resource decorator for the HTTP verb:

@armResourceOperations
interface FooResources {
// Missing @armResourceCreateOrUpdate decorator
@put createOrUpdate(
...ResourceInstanceParameters<FooResource>,
@bodyRoot resource: FooResource,
): ArmResponse<FooResource>;
}
@armResourceOperations
interface FooResources {
get is ArmResourceRead<FooResource>;
createOrUpdate is ArmResourceCreateOrReplaceAsync<FooResource>;
}

Impacts generated SDKs, the API, and Emitters: missing resource operation decorators can leave operations unassociated with the correct resource, breaking the C# SDK and resource-based reasoning, linting, and resource-centric content. Ask the author to use standard resource types, or @customAzureResource if standard types are not possible, and to use operation templates. Accept a suppression only with C# SDK signoff after carefully checking for related violations.