Skip to content

fix(ibm-operationid-naming-convention): extend rule - #767

Merged
diatrcz merged 3 commits into
mainfrom
lt/operation-id-naming-path
Oct 28, 2025
Merged

fix(ibm-operationid-naming-convention): extend rule#767
diatrcz merged 3 commits into
mainfrom
lt/operation-id-naming-path

Conversation

@diatrcz

@diatrcz diatrcz commented Oct 14, 2025

Copy link
Copy Markdown
Contributor

Modifies the operation ID checking logic so it only uses the segments of the path after the version number to create the ID name.

PR Checklist

General checklist

Please make sure that your PR fulfills the following requirements:

  • The commit message follows the Angular Commit Message Guidelines.
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Dependencies have been updated as needed
  • .secrets.baseline has been updated as needed
  • npm run update-utilities has been run if any files in packages/utilities/src have been updated

Checklist for adding a new validation rule:

  • Added new validation rule definition (packages/ruleset/src/rules/*.js, index.js)
  • If necessary, added new validation rule implementation (packages/ruleset/src/functions/*.js, updated index.js)
  • Added new rule to default configuration (packages/ruleset/src/ibm-oas.js)
  • Added tests for new rule (packages/ruleset/test/*.test.js)
  • Added docs for new rule (docs/ibm-cloud-rules.md)
  • Added scoring rubric entry for new rule (packages/validator/src/scoring-tool/rubric.js)

Signed-off-by: Lídia Tarcza <100163235+diatrcz@users.noreply.github.com>
Signed-off-by: Lídia Tarcza <100163235+diatrcz@users.noreply.github.com>
@diatrcz
diatrcz requested a review from pyrooka October 14, 2025 16:00
Comment on lines +222 to +223
const convertedPath =
versionIndex >= 0 ? tempPath.slice(versionIndex + 1) : tempPath;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diatrcz Quick question: what happens if the major version is a double digit, like v12? :) Probably nothing bad and I know this would probably never be the case, but we should try to make the code be prepared for such a scenario. Could you look into this?

@pyrooka pyrooka Oct 22, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, the changes are looking good, this is my only - somewhat theoretical - question.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern /^v\d+$/ matches to double, triple, quadruple, etc. digit versions as well 😄 so the logic stays the same. But I did test it locally as well, just to make sure!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I could change it to /^v\d*+$/, just to be safe.

@diatrcz
diatrcz requested a review from pyrooka October 27, 2025 09:11

@pyrooka pyrooka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

@diatrcz
diatrcz merged commit 67ae17c into main Oct 28, 2025
7 checks passed
@diatrcz
diatrcz deleted the lt/operation-id-naming-path branch October 28, 2025 09:53
ibm-devx-sdk pushed a commit that referenced this pull request Oct 28, 2025
## @ibm-cloud/openapi-ruleset [1.33.3](https://github.com/IBM/openapi-validator/compare/@ibm-cloud/openapi-ruleset@1.33.2...@ibm-cloud/openapi-ruleset@1.33.3) (2025-10-28)

### Bug Fixes

* **ibm-operationid-naming-convention:** only validate after version segment([#767](#767)) ([67ae17c](67ae17c))
@ibm-devx-sdk

Copy link
Copy Markdown

🎉 This PR is included in version 1.33.3 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@ibm-devx-sdk

Copy link
Copy Markdown

🎉 This PR is included in version 1.37.3 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@ibm-devx-sdk

Copy link
Copy Markdown

🎉 This PR is included in version 1.9.1 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants