[Swagger Linter Migration] ParametersInPointGet (origin) - #5210
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 16afb0cd-ea27-47d4-b43b-efa806f86c4e
…arameters-in-point-get
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2fcc235
into
feature/lintdiff-migration-new
|
Finding from the
So the expected follow-up is documentation/evidence only: map So we could use same tsp linter rule PR: #5273 |
Original Swagger linter
Rule:
ParametersInPointGet/ RPC-Get-V1-08Docs: https://github.com/Azure/azure-openapi-validator/blob/6243cb01c16c7535cd3b8df6f45fbeb3c095ed7f/docs/parameters-in-point-get.md
Source: https://github.com/Azure/azure-openapi-validator/blob/6243cb01c16c7535cd3b8df6f45fbeb3c095ed7f/packages/rulesets/src/spectral/functions/parameters-in-point-get.ts
The original rule checks that:
getResourcesPathHierarchyBasedOnResourceTypegetoperations are consideredapi-versionare allowedparametersarrayHow the Swagger linter works
The Spectral function iterates each Swagger path item, asks the ARM path helper whether the URI has at least one resource hierarchy entry, and then inspects the path item's
get.parametersarray. It filters parameters wherein === "query"andname !== "api-version", emitting one diagnostic per offending query parameter at[paths, <uri>, get, parameters].The validator reports emitted OpenAPI operation-parameter occurrences. This PR does not copy that emitted-occurrence cardinality into TypeSpec, and it does not narrow the shared TypeSpec implementation to GET-only because the same TypeSpec rule also intentionally covers the broader staging-only
ValidQueryParametersForPointOperationsSwagger rule for point GET, PUT, PATCH, and DELETE.How the migrated TypeSpec linter works
valid-query-parameters-for-point-operationsvisits TypeSpec operations, resolves eachHttpOperationwithgetHttpOperation, keeps only point-operation paths recognized by the shared ARM point-path helper, and reports query parameters other thanapi-versionon the authored parameter target. The implementation currently covers GET, PUT, PATCH, and DELETE so thatParametersInPointGetandValidQueryParametersForPointOperationsshare one source-level rule.The corpus comparison uses the existing projected TypeSpec result for the selected latest Swagger API version. The 22 TypeSpec-only projects in the GET-only
ParametersInPointGetrow are latest-version PUT/PATCH/DELETE diagnostics explained by the broader staging rule, not older-version-only diagnostics or false positives.Migration evidence
The detailed migration evidence is in
packages/typespec-lintdiff/test/fixtures/ParametersInPointGet/migration.md. It records the focused fixture result, report reconciliation, selected-latest-version population, full-corpus project overlap, TypeSpec-only project explanations, compile failures, diagnostic-cardinality explanation, and the conclusion that no production TypeSpec rule change is required.Generated corpus and coverage files under
packages/typespec-lintdiff/specsare excluded from this PR.