Description
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:
async-stripe-billing
is optional and has featureserialize
- enable
async-stripe-billing
onasync-stripe-webhook
-> crate enabled withoutserialize
feature - enable
serialize
onasync-stripe-webhook
that has dependent featureasync-stripe-billing/serialize
-> crate also enabled with featureserialize
even thought I don't needasync-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