-
Notifications
You must be signed in to change notification settings - Fork 536
Add serde feature flag to prost-types #1252
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
base: master
Are you sure you want to change the base?
Conversation
391a5e6
to
67f74b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I miss documentation of the feature flag
- What does this mean for stability guarantees?
- When you serialize these messages to JSON, it will not be ProtoJSON compatible.
- If we merged this, then WIP: Add json (serde) support #1081 will be a breaking change. Because the JSON names change.
prost-types/Cargo.toml
Outdated
serde_serialize = ["std", "dep:serde"] | ||
serde_deserialize = ["std", "dep:serde"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it important to split the feature? The compiler is smart enough to remove unused code from the binary, right? I suggest having a single serde
feature.
prost-types/Cargo.toml
Outdated
|
||
[dependencies] | ||
prost = { version = "0.13.5", path = "../prost", default-features = false, features = ["prost-derive"] } | ||
arbitrary = { version = "1.4", features = ["derive"], optional = true } | ||
chrono = { version = "0.4.34", default-features = false, optional = true } | ||
serde = { version = "1.0.218", default-features = false, optional = true, features = ["derive", "std"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is std
feature needed?
Adds "serde_deserialize", "serde_serialize" and "serde" flags to prost-types. This will allow users to enable serde support to the well known types. closes tokio-rs#852
67f74b1
to
ea27b80
Compare
However, it probably is best to stabilize proto-json and it'd likely get serde naturally. This would dramatically reduce the chance of creating a breaking change. |
Adds "serde_deserialize", "serde_serialize" and "serde" flags to prost-types. This will allow users to enable serde support to the well known types.
closes #852