feat: add excludedPaths option to no-http-verbs-in-paths rule#2719
feat: add excludedPaths option to no-http-verbs-in-paths rule#2719Daryna-del merged 5 commits intoRedocly:mainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 7eddc40 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Hi @tmchow! Thanks for the contribution! |
| | -------------- | -------- | --------------------------------------------------------------------------------------------------------------------------- | | ||
| | severity | string | Possible values: `off`, `warn`, `error`. Default `off` (in `recommended` configuration). | | ||
| | splitIntoWords | boolean | Matches http verbs when the string is split into words based on casing. This can reduce false positives. Default **false**. | | ||
| | excludedPaths | [string] | List of paths to exclude from the check. Use exact path strings (e.g. `/gettoken`). Default **[]**. | |
There was a problem hiding this comment.
| | excludedPaths | [string] | List of paths to exclude from the check. Use exact path strings (e.g. `/gettoken`). Default **[]**. | | |
| | excludedPaths | [string] | List of paths to exclude from the check. Use exact path strings (e.g. `/token`). Default **[]**. | |
Using verbs in path is generally discouraged, please use nouns in examples.
| - /gettoken | ||
| - /oauth/postback |
| outdent` | ||
| openapi: 3.1.0 | ||
| paths: | ||
| /path/post: |
Address review feedback: - Replace verb-containing example paths with nouns in docs - Run npm run format to fix formatting - Update test paths to match
|
Applied the suggested changes -- replaced verb-containing paths with nouns in the docs examples and test, and ran |
|
@tmchow, I misread the rule 🙈. The rule itself is to detect the wrong naming patterns, so your examples were absolutely correct. Apologies for misleading you. Will you revert the examples back, or shall I merge it as it is and do that myself? |
do you mind doing it? :) |
Sure, we’ll take care of it 🙂 |
|
Hi @tmchow! Thanks again for your contribution! |
What/Why/How?
Adds an
excludedPathsoption to theno-http-verbs-in-pathsrule. Some paths contain HTTP verb substrings that are false positives (e.g./foo/profile-options/). This lets users exclude specific paths from evaluation without polluting the ignore file.Config:
The implementation adds one line to the rule: an early return when the path matches any entry in
excludedPaths. Matching is exact (full path string comparison).Reference
Fixes #1501
Testing
Added a test that verifies
/path/postis excluded while/get/pathis still reported.Check yourself
Security
This contribution was developed with AI assistance (Codex).