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

Fix items serialization when items is a dict #373

Closed
wants to merge 1 commit into from

Conversation

ob-stripe
Copy link
Contributor

r? @dpetrovics-stripe (DP run, feel free to re-assign)
cc @stripe/api-libraries @remi-stripe

Fixes an issue where if you set items to an integer-indexed dict on a subscription that was retrieved from the API, the library would try to unset the properties of the list object that was returned in the items attribute.

This is basically exactly the same problem as the 2nd issue mentioned here: stripe/stripe-ruby#596, and the fix is similar (simply ignore the previous value of items).

@grey-stripe
Copy link
Contributor

I'm fairly nervous about this change, I don't think we should be digging around in the parent class's implementation details, but I'll need to investigate a bit to see if there's a better way to approach this.

@brandur-stripe
Copy link
Contributor

Yeah, it is a little unfortunate that we need to go up and touch the parent's internals.

Just trying to think of some more options: I guess one possibility is to expose a "protected" (in the nomenclature of other OO languages that support more OO stuff) API on the parent that's designed to be called from a child for exactly this purpose (e.g. unset_previous or something).

@ob-stripe ob-stripe force-pushed the ob-sub-items-serialize branch 2 times, most recently from 965ce6f to e827323 Compare December 24, 2017 00:06
@ob-stripe ob-stripe force-pushed the ob-sub-items-serialize branch 2 times, most recently from b5e4890 to b4a3806 Compare July 18, 2018 12:34
@ob-stripe ob-stripe force-pushed the ob-sub-items-serialize branch from b4a3806 to d8775fe Compare July 18, 2018 12:37
@ob-stripe
Copy link
Contributor Author

Closing this super old PR. The issue was probably fixed by #473, though the current state of the library makes it difficult to write a test for this (since the encoding happens in the api_requestor class, which we mock in tests).

@ob-stripe ob-stripe closed this Jun 4, 2019
@ob-stripe ob-stripe deleted the ob-sub-items-serialize branch June 4, 2019 00:44
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