Skip to content

Add ReservedNamesInPropertiesBag linter rule to disallow reserved property names in a resource's properties bag - #850

Merged
tejaswiMinnu merged 5 commits into
Azure:mainfrom
vayada:vayada/billingDataLinterRule
Jul 23, 2026
Merged

Add ReservedNamesInPropertiesBag linter rule to disallow reserved property names in a resource's properties bag#850
tejaswiMinnu merged 5 commits into
Azure:mainfrom
vayada:vayada/billingDataLinterRule

Conversation

@vayada

@vayada vayada commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Adds a new linter rule ReservedNamesInPropertiesBag that reports an error when a property whose name is reserved (matched case-insensitively) is defined in a resource's properties bag. Reserved names are maintained as an extensible list in the rule (currently BillingData); additional names can be added over time.

The BillingData property name is reserved for RP Platform billing integration functionality and is being standardized through Common Types, so resource providers must not define it themselves in their properties bag.

To mitigate the risk of unexpected validation failures in production, the rule is introduced as a staging rule (stagingOnly: true). After the rule has baked in staging LintDiff for approximately 1-2 weeks with no regressions or compatibility issues, it will be promoted to production by removing the staging flag.

@vayada

vayada commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

I don't have required permissions to add label on this PR which is causing one merge validation failure for missing label.

Can someone from maintainer of this repo add following label on this PR.

test-BillingDataInPropertiesBag

@tejaswiMinnu tejaswiMinnu 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.

To release this rule, we need to update two files
packages/rulesets/CHANGELOG.md
packages/rulesets/package.json

check below PR for reference - https://github.com/Azure/azure-openapi-validator/pull/824/changes#diff-cad0ec93b3ac24499b20ae58530a4c3e7f369bde5ba1250dea8cad8201e75c30

Comment thread packages/rulesets/src/spectral/az-arm.ts Outdated
Comment thread docs/billing-data-in-properties-bag.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new Spectral rule to the az-arm ruleset in azure-openapi-validator to prevent a reserved property name (BillingData, case-insensitive) from being defined inside a resource’s properties.properties bag, and wires it into the generated ruleset + documentation.

Changes:

  • Introduces the BillingDataInPropertiesBag Spectral rule (staging-only) and its implementation function.
  • Adds Jest coverage for the rule behavior.
  • Updates generated ruleset output and rule documentation (including docs/rules.md) plus a Rush change entry.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/rulesets/src/spectral/test/billing-data-in-properties-bag.test.ts Adds Jest tests validating the new Spectral rule behavior.
packages/rulesets/src/spectral/functions/billing-data-in-properties-bag.ts Implements the BillingDataInPropertiesBag rule function that finds disallowed occurrences.
packages/rulesets/src/spectral/az-arm.ts Registers the new rule in the ARM Spectral ruleset as stagingOnly.
packages/rulesets/generated/spectral/az-arm.js Updates generated ruleset output to include the new rule/function.
docs/rules.md Adds the rule to the generated rules index.
docs/billing-data-in-properties-bag.md Adds detailed rule documentation and examples.
common/changes/@microsoft.azure/openapi-validator-rulesets/vayada-add-BillingDataInPropertiesBag_2026-07-06-11-12.json Adds a Rush change file documenting the new rule addition.

Comment thread packages/rulesets/src/spectral/functions/billing-data-in-properties-bag.ts Outdated
Comment thread packages/rulesets/src/spectral/test/billing-data-in-properties-bag.test.ts Outdated
Comment thread packages/rulesets/src/spectral/az-arm.ts Outdated
@vayada vayada changed the title Added Linter rule for BillingData property presence in resource's property bag. Add BillingDataInPropertiesBag linter rule to disallow the reserved 'BillingData' property in a resource's properties bag Jul 8, 2026
… release files

- Rework rule function to only traverse schema-structure keywords (properties, allOf/anyOf/oneOf, items, additionalProperties), fixing false positives on BillingData keys inside non-structural metadata (default/enum/vendor extensions). Adds a cycle guard.
- Rewrite tests with realistic schema-form bags; add regression test for metadata false positives and coverage for allOf/items/additionalProperties.
- Remove Rush change file; bump packages/rulesets to 2.3.0 and add CHANGELOG entry (per PR Azure#824 pattern).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread packages/rulesets/package.json Outdated
Comment thread packages/rulesets/CHANGELOG.md Outdated
vayada and others added 2 commits July 9, 2026 13:57
Change packages/rulesets version from 2.3.0 to 2.2.7 (patch bump) and update CHANGELOG heading to '### Patches' per maintainer feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread docs/billing-data-in-properties-bag.md Outdated
Address PR review (@raosuhas): redo the rule to disallow reserved property-bag names via an extensible RESERVED_PROPERTY_NAMES array instead of only 'BillingData'. Rename the rule/function/test/doc, surface a dynamic per-property message via {{error}}, and regenerate docs/rules.md and the az-arm.js bundle.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vayada vayada changed the title Add BillingDataInPropertiesBag linter rule to disallow the reserved 'BillingData' property in a resource's properties bag Add ReservedNamesInPropertiesBag linter rule to disallow reserved property names in a resource's properties bag Jul 22, 2026
@tejaswiMinnu
tejaswiMinnu merged commit a970d99 into Azure:main Jul 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants