Skip to content

Conversation

@richardm-stripe
Copy link
Contributor

@richardm-stripe richardm-stripe commented Sep 23, 2023

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 changed the title [WIP] Types: inner resource classes Types: inner resource classes Oct 6, 2023
@richardm-stripe richardm-stripe force-pushed the richardm-nested-object branch 2 times, most recently from a5e4902 to 42c1964 Compare October 9, 2023 20:31
richardm-stripe and others added 3 commits October 11, 2023 11:36
…sses.py` (#1069)

* Use generated section in object classes file

* Remove generated __future__ imports

* Remove manual __future__ imports

* Business objects -> Object classes

* regenerate
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
@richardm-stripe richardm-stripe changed the base branch from master to beta October 11, 2023 19:57
@richardm-stripe richardm-stripe marked this pull request as ready for review October 11, 2023 19:57
Copy link
Contributor

@pakrym-stripe pakrym-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qs

Copy link
Contributor

@pakrym-stripe pakrym-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should learn to read.

@richardm-stripe richardm-stripe enabled auto-merge (squash) October 11, 2023 20:35
@richardm-stripe richardm-stripe merged commit abf1308 into beta Oct 11, 2023
@richardm-stripe richardm-stripe deleted the richardm-nested-object branch January 26, 2024 16:59
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.

4 participants