Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(property-case-convention): report correct path in errors #526

Merged
merged 1 commit into from
Dec 14, 2022

Conversation

padamstx
Copy link
Member

@padamstx padamstx commented Dec 12, 2022

PR summary

This commit modifies the "property-case-convention" rule slightly so that when it reports a problem with the case for a specific property, the offending property name will be included in the error message, and the path associated with the error will reflect the schema's "properties" field in which the offending property is defined.
This subtle change will ensure that the spectral "unresolver" will not be overzealous when "unresolving" the path.

Signed-off-by: Phil Adams phil_adams@us.ibm.com

Background info on this PR can be found in the issue

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 updated as needed?

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)

This commit modifies the "property-case-convention" rule
slightly so that when it reports a problem with the case
for a specific property, the offending property name will
be included in the error message, and the path associated with
the error will reflect the schema's "properties" field in
which the offending property is defined.
This subtle change will ensure that the spectral "unresolver"
will not be overzealous when "unresolving" the path.

Signed-off-by: Phil Adams <phil_adams@us.ibm.com>
@padamstx padamstx requested a review from dpopp07 December 12, 2022 23:57
@padamstx padamstx self-assigned this Dec 12, 2022
Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

@padamstx padamstx merged commit 3fd84cf into main Dec 14, 2022
@padamstx padamstx deleted the issue-3485 branch December 14, 2022 18:38
ibm-devx-sdk pushed a commit that referenced this pull request Dec 14, 2022
## @ibm-cloud/openapi-ruleset [0.45.1](https://github.com/IBM/openapi-validator/compare/@ibm-cloud/openapi-ruleset@0.45.0...@ibm-cloud/openapi-ruleset@0.45.1) (2022-12-14)

### Bug Fixes

* **property-case-convention:** report correct path in errors ([#526](#526)) ([3fd84cf](3fd84cf))
@ibm-devx-sdk
Copy link

🎉 This PR is included in version 0.45.1 🎉

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

Your semantic-release bot 📦🚀

ibm-devx-sdk pushed a commit that referenced this pull request Dec 14, 2022
## ibm-openapi-validator [0.97.1](https://github.com/IBM/openapi-validator/compare/ibm-openapi-validator@0.97.0...ibm-openapi-validator@0.97.1) (2022-12-14)

### Bug Fixes

* **property-case-convention:** report correct path in errors ([#526](#526)) ([3fd84cf](3fd84cf))

### Dependencies

* **@ibm-cloud/openapi-ruleset:** upgraded to 0.45.1
@ibm-devx-sdk
Copy link

🎉 This PR is included in version 0.97.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