-
Notifications
You must be signed in to change notification settings - Fork 91
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(ibm-well-defined-dictionaries): include patternProperties in validation #713
Conversation
…dation Currently, the rule only considers dictionaries defined with `additionalProperties`. OpenAPI 3.1.x supports defining dictionaries with `patternProperties`, so this commit adds consideration for this field in its validation, in addition to `additionalProperties`. Signed-off-by: Dustin Popp <[email protected]>
43008a9
to
2f2ce01
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -7328,8 +7328,8 @@ paths: | |||
This rule validates that any dictionary schemas are well defined and that all values share a single type. | |||
Dictionaries are defined as object type schemas that have variable key names. They are distinct from model types, | |||
which are objects with pre-defined properties. A schema must not define both concrete properties and variable key names. | |||
Practically, this means a schema must explicitly define a `properties` object or an `additionalProperties` schema, but not both. | |||
If used, the `additionalProperties` schema must define a concrete type. The concrete type of the values must not be a dictionary itself. See the <a href="https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-types">IBM Cloud API Handbook documentation on types</a> for more info. | |||
Practically, this means a schema must explicitly define a `properties` object or an `(additional|pattern)Properties` schema, but not both. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never realized that our API handbook was this opinionated on "properties" vs "additionalProperties" 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's new-ish guidance 🙂 but good guidance, I think!
## @ibm-cloud/openapi-ruleset [1.28.1](https://github.com/IBM/openapi-validator/compare/@ibm-cloud/[email protected]...@ibm-cloud/[email protected]) (2025-01-10) ### Bug Fixes * **ibm-well-defined-dictionaries:** include patternProperties in validation ([#713](#713)) ([ad7134d](ad7134d))
🎉 This PR is included in version 1.28.1 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.32.1 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
Currently, the rule only considers dictionaries defined with
additionalProperties
. OpenAPI 3.1.x supports defining dictionaries withpatternProperties
, so this commit adds consideration for this field in its validation, in addition toadditionalProperties
.PR summary
PR Checklist
General checklist
Please make sure that your PR fulfills the following requirements:
.secrets.baseline
has been updated as needednpm run generate-utilities-docs
has been run if any files inpackages/utilities/src
have been updated