Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inner resource classes #1103

Merged
merged 3 commits into from
Oct 26, 2023
Merged

Conversation

richardm-stripe
Copy link
Contributor

@richardm-stripe richardm-stripe commented Oct 26, 2023

Summary

Like #1061, but merging into master now.

Replaces StripeObject types on resource classes with more granular classes that define the specific fields that can be accessed.

This is not just a type annotation change. We also change the deserialization code in StripeObject.refresh_from and util.convert_to_stripe_object so, in order that the type annotations tell the truth, at runtime, these StripeObject classes will be instances of the more specific classes that are children of StripeObject.

We don't consider changing objects to a more specific subclass to be a breaking change, however, it's possible that any code that uses type(...) == StripeObject instead of instanceof(StripeObject, ...), or does similar introspection, will be affected by this change,

Into beta for now.

Note: There is a very obscure breaking change here: PromotionCode.restrictions.currency_options will now be of type dict instead of StripeObject.

@richardm-stripe richardm-stripe merged commit 4fe269b into master Oct 26, 2023
11 checks passed
@richardm-stripe richardm-stripe deleted the richardm-inner-resource-types branch October 26, 2023 16:32
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.

None yet

2 participants