Skip to content

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 force-pushed the richardm-inner-resource-types branch from beb6fa6 to 4623c4d Compare October 26, 2023 16:07
@richardm-stripe richardm-stripe force-pushed the richardm-inner-resource-types branch from 4623c4d to 12c99e5 Compare October 26, 2023 16:11
@richardm-stripe richardm-stripe merged commit 4fe269b into master Oct 26, 2023
@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.

3 participants