Skip to content

fix(schemas): nest required inside items for usage object arrays#536

Open
rohitsux wants to merge 1 commit into
getlago:mainfrom
rohitsux:fix/usage-object-required-nesting
Open

fix(schemas): nest required inside items for usage object arrays#536
rohitsux wants to merge 1 commit into
getlago:mainfrom
rohitsux:fix/usage-object-required-nesting

Conversation

@rohitsux

@rohitsux rohitsux commented Jun 7, 2026

Copy link
Copy Markdown

Several array schemas declare required as a sibling of items rather than inside the item object:

type: array
required:        # no effect at the array level
  - amount_cents
items:
  type: object
  properties:
    amount_cents: ...

Because the required keyword only applies to object schemas, the listed properties were not actually enforced in any generated client (JS/Python/Ruby/Go).

Changes

  • Move required into the items object for:
    • CustomerChargeFiltersUsageObject
    • CustomerChargeGroupedUsageObject
    • CustomerProjectedChargeFiltersUsageObject
    • CustomerProjectedChargeGroupedUsageObject
    • WalletUpdateInput (the recurring_transaction_rules array)
  • Drop the stale groups entry from the two grouped usage objects — it is listed as required but is not a defined property (the schema uses grouped_by and filters).
  • Regenerate openapi.yaml.

Verification

  • npm run build succeeds.
  • redocly lint drops from 39 to 14 warnings (clears 25 no-required-schema-properties-undefined).
  • spectral lint reports 0 errors.

Several array schemas declared `required` as a sibling of `items`
instead of inside the item object. At the array level the `required`
keyword has no effect, so the listed properties were not actually
required in any generated client.

Move `required` into the `items` object for the customer charge
filter/grouped usage objects (including their projected variants) and
the wallet recurring_transaction_rules array. Also drop the stale
`groups` entry, which is not a defined property on the grouped usage
objects.

This clears 25 redocly `no-required-schema-properties-undefined`
warnings (39 to 14) and makes the required fields enforce correctly in
every generated SDK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant