Skip to content

duplicate-type-name

Id
@typespec/openapi/duplicate-type-name

This diagnostic is issued when a schema or parameter name is a duplicate of another schema or parameter. This generally happens when a model or parameter is renamed with the @friendlyName decorator, resulting in two different TypeSpec types getting the same name in the OpenAPI output.

Change the name or friendly-name of one of the models or parameters.

@friendlyName("User")
model Customer {
id: string;
}
model User {
id: string;
}

Both Customer and User would appear as User in the OpenAPI output, causing a conflict.