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

Implement Serialize if the feature is enabled for response types also #594

Closed
lasantosr opened this issue Aug 23, 2024 · 2 comments
Closed

Comments

@lasantosr
Copy link

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

@mzeitlin11
Copy link
Collaborator

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

@lasantosr
Copy link
Author

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

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

No branches or pull requests

2 participants