arlyon/async-stripe

Implement Serialize if the feature is enabled for response types also

Closed this issue · 2 comments

Is your feature request related to a problem? Please describe.

To avoid reaching Stripe every time, it's common to store the returned data in your database for faster queries (and then listen to webhook updates if you need to).

In order to avoid coupling the database model to the api, it's common to store Stripe responses as json, but that can't be done because response types doesn't implement Serialize, not even under the feature flag.

I'm using the next branch.

Describe the solution you'd like

I would like serde::Serialize macro to be derived on all types if the feature flag is enabled, or maybe an additional flag like extra_serde_derives or something.

Describe alternatives you've considered

Duplicate every single type on my own crate in order to implement the trait on my types, but that's not an option.

Additional context

No response

Thanks for trying out the next branch! I agree that something like that makes sense and should be pretty easy to do (just need to figure out how to make feature flags as ergonomic + granular as possible). Happy to review any pr, or will get to this when have time to return to working on the branch

It was my bad as I didn't see the manual implementation for the serialize trait, I just saw the derive was missing.

It's great as it is! Thanks for the lib