Add BillingDataInPropertiesBag linter rule to disallow the reserved 'BillingData' property in a resource's properties bag#850
Conversation
|
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
left a comment
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
BillingDataInPropertiesBagSpectral 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. |
… 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>
Adds a new linter rule
BillingDataInPropertiesBagthat reports an error when a property namedBillingData(matched case-insensitively) is defined in a resource's properties bag.The
BillingDataproperty 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.