beyond-nesting-levels
@azure-tools/typespec-azure-resource-manager/beyond-nesting-levelsTracked Resources must use 3 or fewer levels of nesting.
Deeply nested resources make the API harder to use and are discouraged by ARM guidelines.
Impact
Section titled “Impact”- Area: API
Nesting resources beyond three levels violates the RPC contract.
LintDiff Equivalent
Section titled “LintDiff Equivalent”This rule corresponds to the LintDiff rule TrackedResourceBeyondThirdLevel.
❌ Incorrect
Section titled “❌ Incorrect”@armProviderNamespacenamespace MyService;
// 4 levels of nesting: A > B > C > D — too deepmodel A is TrackedResource<{}> { ...ResourceNameParameter<A>;}
@parentResource(A)model B is TrackedResource<{}> { ...ResourceNameParameter<B>;}
@parentResource(B)model C is TrackedResource<{}> { ...ResourceNameParameter<C>;}
@parentResource(C)model D is TrackedResource<{}> { ...ResourceNameParameter<D>;}✅ Correct
Section titled “✅ Correct”@armProviderNamespacenamespace MyService;
// 3 levels of nesting: A > B > Cmodel A is TrackedResource<{}> { ...ResourceNameParameter<A>;}
@parentResource(A)model B is TrackedResource<{}> { ...ResourceNameParameter<B>;}
@parentResource(B)model C is TrackedResource<{}> { ...ResourceNameParameter<C>;}Suppression
Section titled “Suppression”Suppress per the RPC guidelines; otherwise restructure so the resource layout has no more than three levels of nesting.