legacy-hierarchy-building-circular-reference
@azure-tools/typespec-client-generator-core/legacy-hierarchy-building-circular-referenceSeverity: error
This diagnostic is issued when @hierarchyBuilding creates a recursive base-type chain.
Impact
Section titled “Impact”- Area: Legacy SDK inheritance rebasing. Blocks hierarchy rebasing because it would create a circular generated base-model chain.
- Not affected: The original TypeSpec inheritance declarations are unchanged.
❌ Incorrect Usage
Section titled “❌ Incorrect Usage”@usage(Usage.input)namespace TestService;
model A extends B { propA: string;}
@hierarchyBuilding(A) // rebasing `B` onto `A` creates a circular base chainmodel B extends C { propB: string;}
model C { propC: string;}Diagnostic Message
Section titled “Diagnostic Message”TCGC reports:
@hierarchyBuilding decorator causes recursive base type reference.✅ How to Fix
Section titled “✅ How to Fix”Remove or change the @hierarchyBuilding decorator so the rebased hierarchy is acyclic.
@usage(Usage.input)namespace TestService;
model A extends B { propA: string;}
model B extends C { propB: string;}
model C { propC: string;}