feat(ipa): Add IPA-111 validation rules - #1460
Draft
mongodb-sage-bot[bot] wants to merge 2 commits into
Draft
Conversation
## Proposed changes Add three new Spectral validation rules enforcing lintable IPA-111 (Default Values) constraints to the IPA Validation Framework: - `xgen-IPA-111-optional-fields-no-default`: optional (non-required) fields must not define a default value. Boolean fields are delegated to the boolean rule below, and fields marked with the new `x-xgen-server-computed-when-client-omitted` extension are exempt. - `xgen-IPA-111-effective-fields-read-only`: effective-value fields (property names prefixed with `effective`) must be `readOnly: true` and must not appear in request schemas. - `xgen-IPA-111-optional-boolean-fields-default-false`: optional boolean fields must default to `false`. Also adds the `IPA-111.yaml` ruleset, registers it in `ipa-spectral.yaml`, regenerates the ruleset README, and introduces shared helpers `isRequiredProperty` (schemaUtils) and `hasServerComputedWhenClientOmittedExtension` (extensions). _Jira ticket:_ CLOUDP-439595 ## 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 |
Contributor
Author
|
❌ Sage Bot - Unexpected Error Sage Bot ran into an unexpected error processing your request. If you need help, reach out in #ask-devprod. |
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
Add three new Spectral validation rules enforcing lintable IPA-111 (Default Values) constraints to the IPA Validation Framework:
xgen-IPA-111-optional-fields-no-default: optional (non-required) fields must not define a default value. Boolean fields are delegated to the boolean rule below, and fields marked with the newx-xgen-server-computed-when-client-omittedextension are exempt.xgen-IPA-111-effective-fields-read-only: effective-value fields (property names prefixed witheffective) must bereadOnly: trueand must not appear in request schemas.xgen-IPA-111-optional-boolean-fields-default-false: optional boolean fields must default tofalse.Also adds the
IPA-111.yamlruleset, registers it inipa-spectral.yaml, regenerates the ruleset README, and introduces shared helpersisRequiredProperty(schemaUtils) andhasServerComputedWhenClientOmittedExtension(extensions).Jira ticket: CLOUDP-439595
Checklist
Changes to Spectral
Important
MongoDB Contribution Guidelines
This pull request was generated by sage-bot on behalf of yeliz.henden@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.