Skip to content

Add BillingDataInPropertiesBag linter rule to disallow the reserved 'BillingData' property in a resource's properties bag#850

Open
vayada wants to merge 2 commits into
Azure:mainfrom
vayada:vayada/billingDataLinterRule
Open

Add BillingDataInPropertiesBag linter rule to disallow the reserved 'BillingData' property in a resource's properties bag#850
vayada wants to merge 2 commits into
Azure:mainfrom
vayada:vayada/billingDataLinterRule

Conversation

@vayada

@vayada vayada commented Jul 6, 2026

Copy link
Copy Markdown

Adds a new linter rule BillingDataInPropertiesBag that reports an error when a property named BillingData (matched case-insensitively) is defined in a resource's properties bag.

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
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
Comment thread docs/billing-data-in-properties-bag.md

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/az-arm.ts
@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>
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.

3 participants