Repository navigation
CLOUDP-415688: add IPA-103, IPA-117 and IPA-131 Spectral rules - #1505
Draft
mongodb-sage-bot[bot] wants to merge 1 commit into
Draft
mongodb-sage-bot[bot] wants to merge 1 commit into
mongodb-sage-bot[bot] wants to merge 1 commit into
Conversation
## Proposed changes Implements the outstanding Spectral rule candidates identified for the Terraform autogeneration IPA enhancements (CLOUDP-356095). - IPA-103 (new ruleset): `xgen-IPA-103-response-body-root-shape` (error) enforces that every JSON response body schema is an object with named properties, or a `oneOf` whose variants are all objects. It rejects arrays, primitives and objects whose only key is `additionalProperties`. IPA-110 collection envelopes (results/links/totalCount) satisfy the rule. - IPA-117: `xgen-IPA-117-oneof-property-descriptions-must-match` (warn) surfaces `oneOf` variants where a shared property's description diverges. - IPA-131 (new ruleset): per-extension structural validation that fires only when the extension is declared: - `xgen-IPA-131-array-semantic` (error): carrying property must be `type: array` and the value must be `list` or `set`. - `xgen-IPA-131-server-computed-when-client-omitted` (error): value must be a boolean and the property must not be listed as required. - `xgen-IPA-131-server-computed-immutable` (error): value must be a boolean and the property must be `readOnly: true`. New rulesets are wired into `ipa-spectral.yaml`, the shared extension constants are added to `functions/utils/extensions.js`, and the generated rulesets README is regenerated. _Jira ticket:_ CLOUDP-415688 ## Checklist - [ ] I have signed the [MongoDB CLA](https://www.mongodb.com/legal/contributor-agreement) - [x] I have added tests that prove my fix is effective or that my feature works ### Changes to Spectral - [x] I have read the [README](../tools/spectral/README.md) file for Spectral Updates
Contributor
Author
|
Sage Bot can help with this pull request. Just |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Implements the outstanding Spectral rule candidates identified for the
Terraform autogeneration IPA enhancements (CLOUDP-356095).
xgen-IPA-103-response-body-root-shape(error)enforces that every JSON response body schema is an object with named
properties, or a
oneOfwhose variants are all objects. It rejectsarrays, primitives and objects whose only key is
additionalProperties.IPA-110 collection envelopes (results/links/totalCount) satisfy the rule.
xgen-IPA-117-oneof-property-descriptions-must-match(warn)surfaces
oneOfvariants where a shared property's description diverges.only when the extension is declared:
xgen-IPA-131-array-semantic(error): carrying property must betype: arrayand the value must belistorset.xgen-IPA-131-server-computed-when-client-omitted(error): value mustbe a boolean and the property must not be listed as required.
xgen-IPA-131-server-computed-immutable(error): value must be aboolean and the property must be
readOnly: true.New rulesets are wired into
ipa-spectral.yaml, the shared extensionconstants are added to
functions/utils/extensions.js, and the generatedrulesets README is regenerated.
Jira ticket: CLOUDP-415688
Checklist
Changes to Spectral
Important
MongoDB Contribution Guidelines
This pull request was generated by sage-bot on behalf of andrei.matei@mongodb.com (ticket assignee). The assignee must self-review the changes before requesting review from another engineer.
The assignee is not allowed to merge their own PR without approval from another engineer.