Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
PR Complexity Score: 5.2 - Moderate
View Breakdown
- Lines Changed: 323
- Files Changed: 33
- Complexity Added: 0
- Raw Score: 105.46
Overview
This PR releases SDK version 3.22.0 and documents it in the changelog.
It fixes mismatches between the SDK’s required parameters and the OpenAPI specifications by making various request fields optional instead of required across many model operation parameter types.
The changes primarily affect TypedDict definitions for request payloads in multiple resources (subscriptions, invoices, quotes, hosted pages, etc.).
Key Changes
- Bumped the SDK version from 3.21.0 to 3.22.0 and added a changelog entry describing the bug fix.
- Updated numerous TypedDict-based request parameter schemas so fields previously marked as
Required[...]are nowNotRequired[...], aligning the SDK with the OpenAPI contracts regarding which parameters are actually mandatory. - Specifically relaxed requirements for nested structures such as
subscription,customer,discounts,subscription_items,tax_providers_fields,item_entitlements, and various nested transaction/tax/credit-note/payment structures used in create/update/import and hosted flows. - Ensured more consistent behavior between SDK-generated types and the API’s true validation rules, reducing false “required field” constraints for SDK consumers.
Risks & Considerations
- Relaxing required fields may allow construction of request payloads that are now type-valid in the SDK but still rejected at runtime by the API if certain combinations are logically required but not modeled as such (e.g., business rules not captured in OpenAPI).
- Existing client code relying on type checking for these fields being required may no longer get static warnings, potentially hiding mistakes until runtime.
- Reviewers should validate that each field changed from required to optional is indeed optional in the current OpenAPI specification and server behavior, to avoid introducing under-specified client contracts.
File-level change summary
| File | Change summary |
|---|---|
| CHANGELOG.md | Added v3.22.0 entry documenting the bug fix about required parameter inconsistencies. |
| VERSION | Bumped the version string from 3.21.0 to 3.22.0. |
| chargebee/models/addon/operations.py | Made tax_providers_fields optional in addon create and update parameter definitions. |
| chargebee/models/alert/operations.py | Made threshold optional in alert create parameters. |
| chargebee/models/coupon/operations.py | Made item and coupon constraint collections optional for coupon create/update for items. |
| chargebee/models/credit_note/operations.py | Relaxed several credit note parameters (transactions, tax_withheld, import collections) from required to optional. |
| chargebee/models/customer/operations.py | Made various nested objects (payment_method, contact, transaction, invoice_allocations) optional in customer-related parameter types. |
| chargebee/models/differential_price/operations.py | Made parent_periods optional for differential price create and update operations. |
| chargebee/models/entitlement/operations.py | Made entitlements optional in entitlement create parameters. |
| chargebee/models/entitlement_override/operations.py | Made entitlement_overrides optional for adding entitlement overrides to subscriptions. |
| chargebee/models/estimate/operations.py | Relaxed multiple estimate parameters (subscription, subscription_items, discounts, gifter/gift_receiver, invoice discounts) from required to optional. |
| chargebee/models/gift/operations.py | Made gifter, gift_receiver, and subscription nested objects optional in gift creation parameters. |
| chargebee/models/hosted_page/operations.py | Made many nested structures (subscription, customer, discounts, customer/gift/quote/payment entities) optional across hosted page flows. |
| chargebee/models/in_app_subscription/operations.py | Made product and subscription nested parameters optional in in-app subscription receipt and import operations. |
| chargebee/models/invoice/operations.py | Relaxed requirements on item_price, discounts, import collections, transaction and tax/credit-note related nested parameters in invoice operations. |
| chargebee/models/item_entitlement/operations.py | Made item_entitlements optional in add and upsert/remove item entitlement operations. |
| chargebee/models/item_price/operations.py | Made tax_providers_fields optional in item price create and update parameters. |
| chargebee/models/order/operations.py | Made the nested credit_note object optional when creating a refundable credit note for an order. |
| chargebee/models/payment_source/operations.py | Made voucher_payment_source and card nested objects optional in payment source creation flows. |
| chargebee/models/payment_voucher/operations.py | Made voucher payment source and invoice allocations optional in payment voucher create parameters. |
| chargebee/models/plan/operations.py | Made tax_providers_fields optional in plan create and update parameters. |
| chargebee/models/portal_session/operations.py | Made the customer object optional when creating a portal session. |
| chargebee/models/price_variant/operations.py | Made attributes optional in price variant create and update parameters. |
| chargebee/models/pricing_page_session/operations.py | Made pricing_page, subscription, and discounts optional in pricing page session create parameters. |
| chargebee/models/purchase/operations.py | Relaxed requirements on purchase items, item tiers, subscription_info, and contract_terms for purchase create and estimate operations. |
| chargebee/models/quote/operations.py | Made subscription, subscription_items, and discounts optional across multiple quote create/update flows, including items and charge-items quotes. |
| chargebee/models/ramp/operations.py | Made collections like items_to_add/items_to_update and discounts_to_add optional in ramp create/update parameters. |
| chargebee/models/recorded_purchase/operations.py | Made the nested customer object optional when creating a recorded purchase. |
| chargebee/models/subscription/operations.py | Made subscription_items, discounts, unbilled_charges, tiers, and related collections optional in several subscription create/update/import flows. |
| chargebee/models/subscription_entitlement/operations.py | Made the subscription_entitlements collection optional for setting entitlement availability. |
| chargebee/models/usage/operations.py | Made the nested invoice object optional in usage PDF parameters. |
| chargebee/models/usage_event/operations.py | Made the events collection optional in usage event batch ingest parameters. |
| chargebee/version.py | Updated the internal SDK version constant to "3.22.0". |
cb-srinaths
approved these changes
May 8, 2026
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.
v3.22.0 (2026-05-07)
Bug fixes: