friendly-name
@azure-tools/typespec-azure-core/friendly-nameEnsures that @friendlyName is used as intended.
Ensures that @friendlyName is used as intended. The @friendlyName decorator should only be applied to template declarations and should reference template parameter properties in the friendly name string.
Impact
Section titled “Impact”- Area: API
@friendlyName is an unscoped way to rename a type for every emitter; it should be replaced by targeted client naming.
❌ Incorrect
Section titled “❌ Incorrect”Using @friendlyName on a non-template type:
@friendlyName("FriendlyModel")model TestModel {}@friendlyName("FriendlyEnum")enum TestEnum { Foo, Bar,}Using @friendlyName on a template without referencing template parameters:
@friendlyName("FriendlyUpdate")op updateTemplate<T>(body: T): T;✅ Correct
Section titled “✅ Correct”Using @friendlyName on a template with template parameter references:
@friendlyName("{name}Page", T)model Page<T> { size: int32; item: T[];}@friendlyName("List{name}", T)op listTemplate<T>(): Page<T>;Suppression
Section titled “Suppression”Do not suppress. Use @clientName instead.