Skip to content

no-route-parameter-name-mismatch

Full name
@azure-tools/typespec-azure-core/no-route-parameter-name-mismatch

Operations over the same resource or using the same path structure should use consistent path parameter names. When two operations resolve to the same resource or path structure but use different names for corresponding path parameters, it typically indicates an inadvertent mismatch in path parameter names.

Two operations with the same path structure but different parameter names:

@route("/subscriptions/{subscriptionId}/providers/Microsoft.Foo/widgets/{widgetName}")
op getWidget(@path subscriptionId: string, @path widgetName: string): void;
@route("/subscriptions/{subscriptionId}/providers/Microsoft.Foo/widgets/{name}")
op updateWidget(@path subscriptionId: string, @path name: string): void;

Multiple operations where the parent resource parameter name is inconsistent:

@route("/providers/Microsoft.Contoso/foos/{fooName}/bars/{barName}")
op getBar(@path fooName: string, @path barName: string): void;
@route("/providers/Microsoft.Contoso/foos/{name}/bars/{barName}")
op updateBar(@path name: string, @path barName: string): void;

All operations use the same parameter names for the same path positions:

@route("/subscriptions/{subscriptionId}/providers/Microsoft.Foo/widgets/{widgetName}")
op getWidget(@path subscriptionId: string, @path widgetName: string): void;
@put
@route("/subscriptions/{subscriptionId}/providers/Microsoft.Foo/widgets/{widgetName}")
op updateWidget(@path subscriptionId: string, @path widgetName: string): void;

Different paths with different parameter names (no conflict):

@route("/providers/Microsoft.Contoso/foos/{fooName}")
op getFoo(@path fooName: string): void;
@route("/providers/Microsoft.Contoso/bars/{barName}")
op getBar(@path barName: string): void;