Skip to content

arm-resource-invalid-envelope-property

Id
@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property

Check for invalid resource envelope properties.

Resource envelope properties must originate from the Azure.ResourceManager namespace. Custom properties that are not part of the standard ARM resource envelope should be placed in the resource-specific property bag instead.

  • Area: API

Defining non-standard top-level envelope properties violates the RPC contract.

This rule corresponds to the LintDiff rule BodyTopLevelProperties.

@armProviderNamespace
namespace MyService;
model FooResource is TrackedResource<{}> {
...ResourceNameParameter<FooResource>;
disallowed?: string; // not valid in the resource envelope
}
@armProviderNamespace
namespace MyService;
model FooResource is TrackedResource<{}> {
...ResourceNameParameter<FooResource>;
...ManagedServiceIdentityProperty;
}

Suppress only when required to match an existing API; otherwise use the standard property mix-ins.

Place the suppression on a shared source property to suppress the violation for every resource that copies the property through a template or model spread:

model LegacyEnvelope {
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Matching legacy API"
legacyEnvelopeValue?: string;
}

Place the suppression on a concrete resource to suppress only that resource while allowing the rule to report other consumers of the same source property:

model LegacyEnvelope {
legacyEnvelopeValue?: string;
}
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Matching legacy API"
model FooResource is TrackedResource<FooProperties> {
...ResourceNameParameter<FooResource>;
...LegacyEnvelope;
}