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.
❌ 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>;}Reviewer advice
Section titled “Reviewer advice”Impacts the API: this corresponds to the LintDiff rule TrackedResourceBeyondThirdLevel and causes an RPC violation. Ask the author to avoid more than three levels of nesting in the resource layout. Accept a suppression only when allowed by RPC guidelines.