Skip to content

replace-parameter-not-found

Id
@azure-tools/typespec-client-generator-core/replace-parameter-not-found

Severity: error

This diagnostic is issued when replaceParameter is called with a selector that does not match any parameter on the operation.

  • Area: Client customization transformations. Blocks replaceParameter from producing the intended customized signature because the selector does not match an operation parameter.
  • Not affected: The original operation signature is unchanged.
@service
namespace MyService {
op myOp(existingParam: string): void;
}
model NewParams {
replacement: int32;
}
alias Modified = replaceParameter(MyService.myOp, "missingParam", NewParams.replacement); // `missingParam` is not a parameter of `myOp`

TCGC reports:

Parameter "missingParam" not found in operation "myOp".

Use the exact name or model property reference for an existing operation parameter.

@service
namespace MyService {
op myOp(existingParam: string): void;
}
model NewParams {
replacement: int32;
}
alias Modified = replaceParameter(MyService.myOp, "existingParam", NewParams.replacement);