[Swagger Linter Migration] GetInOperationName - #5364
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bd1f28a6-d04a-4d89-99d2-f39e205d67e9
|
All changed packages have been documented.
Show changes
|
📦 Package size report✅ No notable package size changes compared to the base branch. 13 package(s) with no notable change
Packed = gzipped |
commit: |
|
You can try these changes here
|
There was a problem hiding this comment.
🟡 Changes recommended
Required documentation and resolver coverage are incomplete, and one release entry identifies the wrong package.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Promotes the Swagger GetInOperationName validation into TCGC.
Changes:
- Adds and tests the
get-operation-namerule. - Registers it disabled by default in both Azure rulesets.
- Adds documentation and release entries.
File summaries
| File | Description |
|---|---|
website/.../reference/linter.md |
Lists the new rule. |
packages/.../test/tester.ts |
Loads OpenAPI test support. |
packages/.../get-operation-name.test.ts |
Adds rule tests. |
packages/.../get-operation-name.rule.ts |
Implements operation-ID validation. |
packages/.../get-operation-name.md |
Documents the rule. |
packages/.../src/linter.ts |
Registers the rule. |
packages/.../README.md |
Lists the rule publicly. |
packages/.../resource-manager.ts |
Registers it disabled for ARM. |
packages/.../data-plane.ts |
Registers it disabled for data plane. |
.chronus/...-tcgc.md |
Records the TCGC feature. |
.chronus/...-rulesets.md |
Records ruleset registration. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the unscoped TCGC library name instead of reconstructing AutoRest operation IDs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 36f23ec9-2dba-44e6-a727-a26129cae550
| return; | ||
| } | ||
|
|
||
| const operationName = getLibraryName(tcgcContext, operation, AllScopes); |
There was a problem hiding this comment.
does this actually need tcgc at all, is that not just operation.name?
There was a problem hiding this comment.
Kept the TCGC resolution intentionally and clarified it in 7118644. An unscoped @clientName changes the generated SdkServiceMethod.name, while operation.name remains the TypeSpec source name. getLibraryName(tcgcContext, operation, AllScopes) validates that common SDK method name and excludes emitter-specific overrides.
Scope the disabled rule to the client SDK ruleset and simplify its diagnostic while retaining TCGC SDK name resolution. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 36f23ec9-2dba-44e6-a727-a26129cae550
| @@ -8,6 +8,8 @@ export default { | |||
| "@azure-tools/typespec-client-generator-core/csharp-model-suffix": true, | |||
| }, | |||
| disable: { | |||
There was a problem hiding this comment.
I think its better to have in enable as false. Makes upgrading after just toggling it. Disabled should more be used in tspconfig
There was a problem hiding this comment.
also just thinking about this being a tcgc rule was that supposed to apply to data plane too or just ARM?
Original Swagger linter
The Swagger rule checks GET operation IDs for a
GetorListverb, either directly or after an operation-group prefix. Its underlying purpose is to ensure generated SDK methods clearly communicate whether they retrieve one resource or list several resources.Promoted TypeSpec rule
The promoted
@azure-tools/typespec-client-generator-core/get-operation-namerule validates the SDK method name modeled by TCGC rather than reconstructing an AutoRest-specific SwaggeroperationId.The rule:
@clientNameoverride;@operationId, client/operation-group location, and emitter-scoped name overrides because those do not define the common TCGC SDK method name;getorlistcase-insensitively so the language-neutral TCGC name can use its normal lower-camel casing;This keeps the rule in TCGC, where the generated SDK API name is modeled, without introducing an AutoRest dependency or duplicating AutoRest's operation-ID resolver. The rule is registered but disabled by default in both Azure data-plane and resource-manager rulesets.
Migration note
This is an intent-preserving migration rather than a byte-for-byte check of the Swagger
operationId. Explicit@operationIdvalues and operation-group prefixes can therefore differ from the value checked by the native rule. Those differences are intentional: the native rule enforces the generated SDK method-name guideline at the TCGC abstraction layer.Validation
git diff --check