jiengup commented on code in PR #4204:
URL: https://github.com/apache/iggy/pull/4204#discussion_r4037077513
##########
core/connectors/sdk/src/lib.rs:
##########
@@ -157,6 +157,26 @@ pub enum Payload {
}
impl Payload {
+ /// The `Schema` describing this payload's variant.
+ ///
+ /// Not the same thing as `StreamDecoder::schema`, which names the wire
+ /// format a decoder reads rather than the variant it hands back: the Avro
+ /// and FlatBuffer decoders return `Payload::Json` whenever
`extract_as_json`
+ /// is set, and the Proto decoder returns `Payload::Json` or `Payload::Raw`
+ /// depending on the path it takes. A transform may change the variant
again
+ /// after that. Anything tagging a payload for transport has to read the
tag
+ /// off the payload it actually holds.
+ pub const fn schema(&self) -> Schema {
+ match self {
+ Payload::Json(_) => Schema::Json,
+ Payload::Raw(_) => Schema::Raw,
+ Payload::Text(_) => Schema::Text,
+ Payload::Proto(_) => Schema::Proto,
Review Comment:
The PR promises that the tag describes the actual payload after transforms.
That does not hold for `Payload::Proto`:
1. proto_convert.rs#L627-L657 can return `Payload::Proto(json_string)` when
no descriptor is configured or schema encoding fails.
2. The new runtime logic tags its UTF-8 bytes as `Schema::Proto`.
3. The receiver’s Schema::try_into_payload interprets those bytes as binary
protobuf `Any`, falling back to `Payload::Raw`, never reconstructing
`Payload::Proto`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]