Skip to content

friendly-name

Full name
@azure-tools/typespec-azure-core/friendly-name

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.

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;

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>;