Add no-route-parameter-name-mismatch linting rule to detect inconsistent path parameter names#4144
Add no-route-parameter-name-mismatch linting rule to detect inconsistent path parameter names#4144
no-route-parameter-name-mismatch linting rule to detect inconsistent path parameter names#4144Conversation
Detects when two operation routes differ only by path parameter name. Skips operations with allowReserved path parameters. Adds rule to both data-plane and resource-manager rulesets. Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/e2d6639c-a39b-4eaf-a501-9e4def91a83f Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/e2d6639c-a39b-4eaf-a501-9e4def91a83f Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
no-route-parameter-name-mismatch linting rule to detect inconsistent path parameter names
packages/typespec-azure-core/test/rules/no-route-parameter-name-mismatch.test.ts
Show resolved
Hide resolved
…ule-for-path-parameters Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
…skipping Instead of skipping operations with allowReserved path parameters, the rule now checks them for both name consistency and allowReserved consistency. A separate diagnostic (allowReservedMismatch) is emitted when matching path parameters differ in their allowReserved setting. Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/47627bee-1bca-4437-86b5-29010733205d Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Merged latest from main and applied the suggested changes for |
|
@copilot Please pull the latest from main and regenerate samples - fix any issues that cause unexpected diagnostics in existing specs. |
|
@copilot also validate that all tests are passing and all files are correctly formatted. |
|
@copilot Also, contrary to my previous suggestion, we should not attempt to match parameters that have differing 'allowReserved' settings. Please adjust the tests and the code as appropriate, pull the latest from main, ensure all tests are passing and all files are correctly formatted |
…ples
Extension resources legitimately use different allowReserved scope
parameter names ({resourceUri} vs {scope}). When both parameters at
the same position use allowReserved, skip the name mismatch check.
Regenerated docs to include the new rule in linter reference.
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/526d3364-b839-4f9a-b5e7-8ae4e6676796
Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Pulled latest from main, regenerated samples/docs, and fixed the unexpected diagnostic in |
…param uses allowReserved Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/eed61191-36ca-4ed5-9185-aa5020b30f76 Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Removed the
Validated in 39f7331 — all 54 azure-core test files pass (319 tests), all 68 sample tests pass, and files are correctly formatted. |
…ule-for-path-parameters Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
…-mismatch rule Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/deb5142d-513b-4111-8442-e814a1b12f78 Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Fixed in a2d52ea. Pulled latest from main, updated the rule to skip paths with consecutive path variables (no static segment between them), and added a test. All 54 azure-core test files pass (321 tests), all 68 sample tests pass, files are formatted. |
|
/azp run typespec-azure - PR Tools |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
markcowl
left a comment
There was a problem hiding this comment.
Pull the latest from main, make the changes suggested, make test validation changes to match, and add test coverage if necessary to cover code changes in the linting rule.
Ensure all tests pass, all files are formatted correctly, and the branch is up to date with main, with no merge issues
.chronus/changes/no-route-parameter-name-mismatch-2026-03-28-00-45-00.md
Outdated
Show resolved
Hide resolved
packages/typespec-azure-core/src/rules/no-route-parameter-name-mismatch.ts
Outdated
Show resolved
Hide resolved
packages/typespec-azure-core/src/rules/no-route-parameter-name-mismatch.ts
Show resolved
Hide resolved
packages/typespec-azure-core/test/rules/no-route-parameter-name-mismatch.test.ts
Show resolved
Hide resolved
…ule-for-path-parameters Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
…h, update tests Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/e217ec23-11fb-4e1c-bd0c-86ffee2e5fbd Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Pulled latest from main and applied all requested changes in 1f204ec. All 54 azure-core test files pass (321 tests), all 68 sample tests pass, and files are formatted correctly. |
markcowl
left a comment
There was a problem hiding this comment.
Make the changes, validate that all tests pass and all files are correctly formatted. Pull the latest from main ensure there are no merge issues and only the files that are part of this change are in the PR
packages/typespec-azure-core/test/rules/no-route-parameter-name-mismatch.test.ts
Show resolved
Hide resolved
… validation Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/1adc0c41-80b2-4879-93e1-c96619a99569 Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Fixed in 47e7f4a. Pulled latest from main (already up to date), updated the test to use exact routes from reviewer's suggestion, all 54 azure-core test files pass (321 tests), files are formatted. Only the test file changed in this commit. |
|
/azp run typespec-azure - CI |
|
Azure Pipelines successfully started running 1 pipeline(s). |
foos/{fooName}/bars/{name}vsfoos/{name}/bars/{barName}producing two diagnostics💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.