feat(ibm-operationid-naming-convention): extend operationid naming check - #757
Conversation
Signed-off-by: Lídia Tarcza <100163235+diatrcz@users.noreply.github.com>
Signed-off-by: Lídia Tarcza <100163235+diatrcz@users.noreply.github.com>
|
|
||
| const verbs = []; | ||
|
|
||
| // Verbs where pluralization can happen in the operationId based on the path |
There was a problem hiding this comment.
| // Verbs where pluralization can happen in the operationId based on the path | |
| // Verbs where pluralization can happen in the operationId based on the path. |
| // If we have an acceptable verb, then make sure | ||
| // that the operationId starts with that verb | ||
| // and that the rest of the operation id matches the path according to the naming conventions |
There was a problem hiding this comment.
| // If we have an acceptable verb, then make sure | |
| // that the operationId starts with that verb | |
| // and that the rest of the operation id matches the path according to the naming conventions | |
| // If we have an acceptable verb, then make sure | |
| // that the operationId starts with that verb | |
| // and that the rest of the operation id matches | |
| // the path according to the naming conventions. |
| const convertedPath = fullPath | ||
| .replace(/^\/+/, '') | ||
| .split('/') | ||
| .filter(part => !/^\{.*\}$/.test(part)); |
There was a problem hiding this comment.
| .filter(part => !/^\{.*\}$/.test(part)); | |
| .filter(part => !part.startsWith('{') && !part.endsWith('}')); |
| .split('/') | ||
| .filter(part => !/^\{.*\}$/.test(part)); | ||
|
|
||
| //singularize the words in the path according to the naming conventions |
There was a problem hiding this comment.
| //singularize the words in the path according to the naming conventions | |
| // Singularize the words in the path according to the naming conventions. |
| for (let i = 0; i < verbs.length; i++) { | ||
| const correctId = verbs[i] + '_' + convertedPath.join('_'); | ||
| if (correctId === operationId) | ||
| return { checkPassed: true, correctId, operationId }; |
There was a problem hiding this comment.
| return { checkPassed: true, correctId, operationId }; | |
| return { checkPassed: true }; |
… naming check Signed-off-by: Lídia Tarcza <100163235+diatrcz@users.noreply.github.com>
Signed-off-by: Lídia Tarcza <100163235+diatrcz@users.noreply.github.com>
pyrooka
left a comment
There was a problem hiding this comment.
Looks good!
I think we should use a feat type commit for this PR when merging it, since it adds new functionality to a rule, not just fixes an issue. Just my thought, up to you! :)
# @ibm-cloud/openapi-ruleset [1.32.0](https://github.com/IBM/openapi-validator/compare/@ibm-cloud/openapi-ruleset@1.31.2...@ibm-cloud/openapi-ruleset@1.32.0) (2025-08-27) ### Features * **ibm-operationid-naming-convention:** extend operationid naming check ([#757](#757)) ([72bf9f2](72bf9f2))
|
🎉 This PR is included in version 1.32.0 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
# ibm-openapi-validator [1.36.0](https://github.com/IBM/openapi-validator/compare/ibm-openapi-validator@1.35.3...ibm-openapi-validator@1.36.0) (2025-08-27) ### Features * **ibm-operationid-naming-convention:** extend operationid naming check ([#757](#757)) ([72bf9f2](72bf9f2)) ### Dependencies * **@ibm-cloud/openapi-ruleset:** upgraded to 1.32.0
|
🎉 This PR is included in version 1.36.0 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.9.1 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
Extends the ibm-operationid-naming-convention rule so now it checks if operation IDs follow the handbook naming convention rule or not.
PR Checklist
General checklist
Please make sure that your PR fulfills the following requirements:
.secrets.baselinehas been updated as needednpm run update-utilitieshas been run if any files inpackages/utilities/srchave been updatedChecklist for adding a new validation rule: