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

next: Activating serialize feature on async-stripe-webhook results in compile error #663

Open
robko23 opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@robko23
Copy link

robko23 commented Jan 23, 2025

Describe the bug

When enabling (de)serialize feature on async-stripe-webhook@next results in compilation error with messages that events don't implement serde::Serialize/serde::Deserialize.

My temporary fix to make it compile is this patch:

diff --git a/async-stripe-webhook/Cargo.toml b/async-stripe-webhook/Cargo.toml
index 44d1a084..6490dd5f 100644
--- a/async-stripe-webhook/Cargo.toml
+++ b/async-stripe-webhook/Cargo.toml
@@ -39,8 +39,31 @@ async-stripe-treasury = { path = "../generated/async-stripe-treasury", optional
 serde_json.workspace = true

 [features]
-serialize = ["async-stripe-types/serialize", "async-stripe-shared/serialize"]
-deserialize = ["async-stripe-types/deserialize", "async-stripe-shared/deserialize", "dep:serde_json"]
+serialize = [
+       "async-stripe-types/serialize",
+       "async-stripe-shared/serialize",
+       "async-stripe-billing/serialize",
+       "async-stripe-checkout/serialize",
+       "async-stripe-core/serialize",
+       "async-stripe-fraud/serialize",
+       "async-stripe-misc/serialize",
+       "async-stripe-payment/serialize",
+       "async-stripe-terminal/serialize",
+       "async-stripe-treasury/serialize",
+]
+deserialize = [
+       "async-stripe-types/deserialize",
+       "async-stripe-shared/deserialize",
+       "dep:serde_json",
+       "async-stripe-billing/deserialize",
+       "async-stripe-checkout/deserialize",
+       "async-stripe-core/deserialize",
+       "async-stripe-fraud/deserialize",
+       "async-stripe-misc/deserialize",
+       "async-stripe-payment/deserialize",
+       "async-stripe-terminal/deserialize",
+       "async-stripe-treasury/deserialize",
+]

but this enables all the optional crates and results in compiling code that I don't use elsewhere.

The solution would need to be in AND fashion, not OR.
Now the resolution works like this:

  1. async-stripe-billing is optional and has feature serialize
  2. enable async-stripe-billing on async-stripe-webhook -> crate enabled without serialize feature
  3. enable serialize on async-stripe-webhook that has dependent feature async-stripe-billing/serialize -> crate also enabled with feature serialize even thought I don't need async-stripe-billing

The ideal solution would work like this:
async-stripe-webhook enables serialize AND async-stripe-billing.
this activates async-stripe-billing/serialize, but not the other crates.

Right now I don't have idea how to solve this, but that could just be my limited experience with cargo features.
If you have an idea how to solve it, I would be more than willing to open a PR to resolve this

To Reproduce

Expected behavior

Code snippets

OS

Linux

Rust version

1.84.0

Library version

next

API version

2024-04-10

Additional context

No response

@robko23 robko23 added the bug Something isn't working label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant