Skip to content

reorder-parameter-duplicate

Id
@azure-tools/typespec-client-generator-core/reorder-parameter-duplicate

Severity: error

This diagnostic is issued when reorderParameters lists the same parameter name more than once.

  • Area: Client customization transformations. Blocks reorderParameters because a duplicated name would make the generated method parameter order ambiguous.
  • Not affected: The operation’s actual parameters are unchanged.
@service
namespace MyService {
op myOp(a: string, b: string): void;
}
alias Modified = reorderParameters(MyService.myOp, #["a", "a"]); // `a` appears twice

TCGC reports:

Parameter "a" appears more than once in the reorder list for operation "myOp".

Include each parameter exactly once in the reorder list.

@service
namespace MyService {
op myOp(a: string, b: string): void;
}
alias Modified = reorderParameters(MyService.myOp, #["b", "a"]);