[Swagger Linter Migration] ListInOperationName (origin) - #5378
Draft
Yuchao Yan (msyyc) wants to merge 3 commits into
Draft
[Swagger Linter Migration] ListInOperationName (origin)#5378Yuchao Yan (msyyc) wants to merge 3 commits into
Yuchao Yan (msyyc) wants to merge 3 commits into
Conversation
Resolve emitted AutoRest operation IDs, mirror Swagger response and verb scope, and document corpus equivalence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4362cc59-54c1-452d-bc77-787dd59e5d6f
…into feature/lintdiff-list-in-operation-name
…ist-in-operation-name
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
The Swagger rule:
paths;Noun_List*or exactlyList;x-ms-pageable, regardless of response shape; andvaluearray and no more than one additional property.How the Swagger linter works
The Spectral selector passes each GET or POST operation object to the rule. The implementation first checks the operation ID against
^((\w+_List\w*)|List)$, then looks forx-ms-pageable. If that extension is absent, it resolves response schemas and looks for the validator's narrow collection shape. Diagnostics are attached to the selected OpenAPI operation, so emitted operation IDs and emitted response structure are the source of truth.How the migrated TypeSpec linter works
The migrated rule now resolves the operation ID the same way AutoRest does, including explicit
@operationId, client names and locations, interface/namespace grouping, and underscore-segment capitalization. The resolver is shared withGetInOperationName.For GET and POST operations, it detects explicit
x-ms-pageable, an inherited@listoperation that emits paging because a next link exists, or the validator-equivalentvalue-array response shape. It avoids internal top-level template instances while retaining authored custom ARM operations, and targets the authored interface when an inherited operation node comes from library code. This fixes legacy operations that emit IDs such asOperations_Getwithout duplicating diagnostics on standard ARM templates.Official
use-standard-namesand ARM templates provide partial coverage, but custom ARM operations remain authorable and the generic naming rule is disabled in the ARM ruleset, so the direct rule remains necessary.Migration evidence
See ListInOperationName migration evidence for the 12-case emission matrix, full 468-project corpus reconciliation, 53/53 assessable project overlap, 172/172 selected-version emitted-operation attribution, compile failures, and explanations for every raw one-sided result.