Skip to content

arm-resource-name-pattern

Id
@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern

The resource name parameter should be defined with a ‘pattern’ restriction.

Use a regular expression that accurately describes valid resource names so invalid names can be rejected before requests are sent.

  • Area: API

The resource name lacks the required pattern restriction, violating the RPC contract.

This rule corresponds to the LintDiff rule ResourceNameRestriction.

model Employee is ProxyResource<{}> {
@key("employeeName")
@path
@segment("employees")
name: string;
}
model Employee is ProxyResource<{}> {
...ResourceNameParameter<Employee>;
}

Suppress only when required to match an existing API; otherwise use @pattern or the ResourceNameParameter template with a pattern string or union type.