[Swagger Linter Migration] GetInOperationName (origin) - #5317
Merged
Yuchao Yan (msyyc) merged 3 commits intoSep 1, 2026
Merged
Conversation
Resolve effective AutoRest operation IDs, including TCGC naming, and ignore non-emitted template artifacts. Add focused fixtures and full-corpus migration evidence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2e9e55e7-e58a-40a9-811b-5023299a9096
…et-in-operation-name
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates GetInOperationName to validate effective AutoRest operation IDs with case-sensitive Get/List semantics.
Changes:
- Reconstructs emitted IDs using explicit and TCGC naming metadata.
- Excludes template artifacts.
- Adds fixtures and migration evidence.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
template-declaration-ignored/validator-diagnostics.json |
Records validator result. |
template-declaration-ignored/tsp-diagnostics.json |
Records TypeSpec diagnostics. |
template-declaration-ignored/output.json |
Captures emitted Swagger. |
template-declaration-ignored/main.tsp |
Defines template scenario. |
template-declaration-ignored/expect.json |
Declares expected compliance. |
GetInOperationName/rule.md |
Documents rule semantics and scope. |
GetInOperationName/migration.md |
Provides migration evidence. |
lowercase-emitted-list/validator-diagnostics.json |
Records validator violation. |
lowercase-emitted-list/tsp-diagnostics.json |
Records matching lint violation. |
lowercase-emitted-list/output.json |
Captures lowercase emitted ID. |
lowercase-emitted-list/main.tsp |
Defines lowercase-ID scenario. |
lowercase-emitted-list/expect.json |
Declares expected violation. |
empty-client-location-compliant/validator-diagnostics.json |
Records validator compliance. |
empty-client-location-compliant/tsp-diagnostics.json |
Records TypeSpec compliance. |
empty-client-location-compliant/output.json |
Captures emitted ID. |
empty-client-location-compliant/main.tsp |
Tests empty client location. |
empty-client-location-compliant/expect.json |
Declares expected compliance. |
emitted-operation-id-compliant/validator-diagnostics.json |
Records validator compliance. |
emitted-operation-id-compliant/tsp-diagnostics.json |
Records TypeSpec compliance. |
emitted-operation-id-compliant/output.json |
Captures explicit operation ID. |
emitted-operation-id-compliant/main.tsp |
Tests explicit ID precedence. |
emitted-operation-id-compliant/expect.json |
Declares expected compliance. |
compliant-with-template/tsp-diagnostics.json |
Updates emitted ID in warning. |
compliant-with-template/main.tsp |
Reformats template fixture. |
client-name-location-compliant/validator-diagnostics.json |
Records validator compliance. |
client-name-location-compliant/tsp-diagnostics.json |
Records TypeSpec compliance. |
client-name-location-compliant/output.json |
Captures TCGC-resolved ID. |
client-name-location-compliant/main.tsp |
Defines TCGC naming scenario. |
client-name-location-compliant/expect.json |
Declares expected compliance. |
src/rules/get-in-operation-name.ts |
Implements emitted-ID validation. |
package.json |
Adds the TCGC peer dependency. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Retain reproducible full-corpus evidence and ensure the TCGC fixture depends on client-name resolution. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: de35f2d0-faec-4f57-8cab-3b8a90dab49c
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 32 out of 32 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
packages/typespec-lintdiff/package.json:64
- This published package change adds a runtime peer dependency and changes lint behavior, but there is no Chronus entry for
@azure-tools/typespec-lintdiff. The package workflow requirespnpm change addbefore opening a PR (packages/typespec-lintdiff/README.md:94-95), so please add the corresponding change description.
"@azure-tools/typespec-client-generator-core": "workspace:^",
Yuchao Yan (msyyc)
marked this pull request as ready for review
September 1, 2026 08:38
Yuchao Yan (msyyc)
requested review from
Mark Cowlishaw (markcowl),
Timothee Guerin (timotheeguerin) and
Jeff Fisher (xirzec)
as code owners
September 1, 2026 08:38
Yuchao Yan (msyyc)
merged commit Sep 1, 2026
93645fc
into
feature/lintdiff-migration-new
3 checks passed
Yuchao Yan (msyyc)
deleted the
feature/lintdiff-get-in-operation-name
branch
September 1, 2026 08:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original Swagger linter
GetInOperationNameverifies ARM GEToperationIdnaming.The original rule performs these checks:
operationIdvalues under GET operations in bothpathsandx-ms-paths;GetorList;GetorList;operationIdpath.How the Swagger linter works
The Azure ruleset selects
$[paths,'x-ms-paths'].*[get][?(@property === 'operationId')]and passes each resolved scalar to a Spectral function. The function returns no result for an empty or non-string value, then applies^(\w+)_(Get|List)and^(Get|List). A failure is attached to the selected JSON path, so reused or multiply emitted operations can produce occurrence-level diagnostics.The migration preserves the case-sensitive naming contract rather than the previous TypeSpec implementation's lowercase source-name approximation. Empty/non-string OpenAPI values do not require a TypeSpec exemption because AutoRest resolves a string operation ID for an emitted semantic operation.
How the migrated TypeSpec linter works
The TypeSpec rule visits semantic operations, resolves their HTTP shape with
getHttpOperation, and checks only GET operations. It ignores generic template declarations and instances that have no emitted operation while continuing to check concrete operations created from templates.For each operation, it reproduces AutoRest operation-ID resolution: explicit
@operationIdwins; otherwise one AutoRest-scoped TCGC context supplies@clientNameand@clientLocationoverrides, including AutoRest's falsy empty-location behavior. Interface/namespace prefixes and underscore-segment capitalization match the emitter. The original case-sensitive regexes are then applied to that effective ID, and diagnostics target the authored TypeSpec operation while naming the emitted ID.Migration evidence
The detailed migration evidence records focused violating/compliant fixtures, report reconciliation, code-backed DataMigration/template/TCGC gap examples, full project lists, diagnostic identities, selected-version policy, compile failures, and remaining uncertainty.
The final pinned full corpus run reached 26/26 same-project overlap with no one-sided projects and 39 aligned diagnostics from each engine. Six TypeSpec compile failures remain explicitly excluded from behavioral comparison. Independent review also identified the empty
@clientLocationedge case; the fix has a dedicated fixture and real-service regression checks.