Open woodruffw opened 4 months ago
I don't have a deep insight into the wire format, but I my understanding is that an optional
field is is treated as a oneof
, so removing it will have some effects. This can be verified by looking the generated Go code, and it's annotations:
Old: (with optional)
RawBytes []byte `protobuf:"bytes,1,opt,name=raw_bytes,json=rawBytes,proto3,oneof" json:"raw_bytes,omitempty"`
New: (without optional)
RawBytes []byte `protobuf:"bytes,1,opt,name=raw_bytes,json=rawBytes,proto3" json:"raw_bytes,omitempty"`
That said, I don't know if that affects the binary format. It may?
That said, I don't know if that affects the binary format. It may?
Yeah, I think oneof
means a wire format change 😞
So the follow-on question: do we care 😅? Everything (?) that consumes these specs uses the JSON encoding, which isn't affected by this, so in practice it isn't a breaking change.
So the follow-on question: do we care 😅? Everything (?) that consumes these specs uses the JSON encoding, which isn't affected by this, so in practice it isn't a breaking change.
I'm with you (that we don't care). The client spec should state the the canonical format is JSON, so no clients are expected to ever deal with the binary format.
But I would still like to verify it that the language bindings for JSON does not mess this up. I don't think they should, but here I would rather test twice 😇
But I would still like to verify it that the language bindings for JSON does not mess this up. I don't think they should, but here I would rather test twice 😇
Makes sense! I can look into some test assets to include in this repo -- my thinking is that each language client could have a small test suite to ensure that bundles (of various versions) get loaded correctly.
This needs careful review/consideration from someone who understands the protobuf wire format better than I do 🙂:
optional
?Closes #325.