Repository navigation
Report operation parameters as op::parameters in type names - #11551
Timothee Guerin (timotheeguerin) merged 4 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
…ameters` Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
op::parameters in type names
commit: |
|
All changed packages have been documented.
Show changes
|
There was a problem hiding this comment.
Pull request overview
This PR improves diagnostic stability/readability by recognizing anonymous models that represent an operation’s parameters and naming them as Namespace.(Interface.)op::parameters (instead of rendering the anonymous model expression).
Changes:
- Updated
getModelNameto detect operation-parameter model expressions and format them asop::parameters(including interface prefix when applicable). - Added
getOperationParametersNameto walk the syntax tree fromModelExpression→OperationSignatureDeclaration.parameters→OperationStatement. - Updated/added test expectations and introduced focused unit tests for the new naming behavior; added a Chronus entry for the compiler fix.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/versioning/test/incompatible-versioning.test.ts | Updates expected diagnostics to use op::parameters-based naming. |
| packages/compiler/test/helpers/type-name-utils.test.ts | Adds unit coverage for operation-parameter naming (including interface + nameOnly). |
| packages/compiler/test/decorators/decorators.test.ts | Updates @overload error expectation to reflect new parameter-model naming. |
| packages/compiler/src/core/helpers/type-name-utils.ts | Implements detection/rendering of operation-parameter anonymous models as op::parameters. |
| .chronus/changes/improve-operation-parameters-type-name-2026-7-5.md | Adds changelog entry documenting the compiler diagnostic improvement. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
packages/compiler/test/helpers/type-name-utils.test.ts:67
- Avoid casting the resolved operation to
anyhere; it bypasses type-checking and can hide errors ifresolveTypeReferencereturns a non-operation type. You can keep this type-safe by asserting the resolved value is anOperationand using non-null assertions for the looked-up parameter.
const [op] = program.resolveTypeReference("Foo.Bar.test");
const param = (op as any).parameters.properties.get("param");
packages/compiler/test/helpers/type-name-utils.test.ts:77
- Avoid casting the resolved operation to
anyhere; it bypasses type-checking and can hide errors ifresolveTypeReferencereturns a non-operation type. You can keep this type-safe by asserting the resolved value is anOperationand using non-null assertions for the looked-up parameter.
const [op] = program.resolveTypeReference("Foo.test");
const param = (op as any).parameters.properties.get("param");
Diagnostics referencing an operation's parameter printed the anonymous model expression, e.g.
TestService.{ param: TestService.Foo }.param, which is neither stable nor traceable back to the operation.getTypeNamehad no way to resolve the "parent" of a parameters model expression, so it fell back to the generic anonymous-model rendering.Changes
getModelName(packages/compiler/src/core/helpers/type-name-utils.ts): for an anonymous model, first attempt to resolve it as an operation's parameters.getOperationParametersName: walks the syntax tree (ModelExpression→OperationSignatureDeclaration.parameters→OperationStatement) to renderNamespace.op::parameters, including the interface prefix when the operation is on an interface, andop::parametersundernameOnly.packages/versioning/test/incompatible-versioning.test.tsand the@overloadcase inpackages/compiler/test/decorators/decorators.test.ts; added coverage intype-name-utils.test.ts.Example
Before:
After:
This also improves unrelated messages built on the same helper, e.g.
@overloadmismatches now readProperty 'param' is missing on type 'someUnrelatedThing::parameters' but required in 'someThing::parameters'.