Closed rnbguy closed 2 years ago
Going through the serialize function, I realized, it calls try_unpack()
try_unpack()
https://github.com/fdeantoni/prost-wkt/blob/190d4d310249b65581d1c50963f3cf2ac031ce24/wkt-types/src/pbany.rs#L138-L140
which may fail because "value" is assigned to {} in this block and the Message type may not derive #[serde(default)].
"value"
{}
Message
#[serde(default)]
https://github.com/fdeantoni/prost-wkt/blob/190d4d310249b65581d1c50963f3cf2ac031ce24/wkt-types/src/pbany.rs#L113-L119
In such cases, serialization defaults to {"@type": ..., "value": ...}.
{"@type": ..., "value": ...}
https://github.com/fdeantoni/prost-wkt/blob/190d4d310249b65581d1c50963f3cf2ac031ce24/wkt-types/src/pbany.rs#L142-L143
This breaks the protobuf serialization to JSON for the Any types without #[serde(default)].
Going through the serialize function, I realized, it calls
try_unpack()
https://github.com/fdeantoni/prost-wkt/blob/190d4d310249b65581d1c50963f3cf2ac031ce24/wkt-types/src/pbany.rs#L138-L140
which may fail because
"value"
is assigned to{}
in this block and theMessage
type may not derive#[serde(default)]
.https://github.com/fdeantoni/prost-wkt/blob/190d4d310249b65581d1c50963f3cf2ac031ce24/wkt-types/src/pbany.rs#L113-L119
In such cases, serialization defaults to
{"@type": ..., "value": ...}
.https://github.com/fdeantoni/prost-wkt/blob/190d4d310249b65581d1c50963f3cf2ac031ce24/wkt-types/src/pbany.rs#L142-L143
This breaks the protobuf serialization to JSON for the Any types without
#[serde(default)]
.