Closed purkhusid closed 2 years ago
@Arshia001 I've been using these patches in production for a few months now and not faced any issues so far and we are interoping with e.g. the rust protobuf implementation in https://github.com/tokio-rs/prost
Is there any chance to get this merged?
Closed in #16.
What?
This changes the generator to not return
ValueOption
for scalar types and return default values according to the proto3 spec: https://developers.google.com/protocol-buffers/docs/proto3#defaultWhy?
The proto3 wire format does not make it possible to know if a value was intentionally set to the default value of a scalar
The spec dictates that scalar fields should always return default values and only message fields should have language specific implementations
Since support for the
optional
keyword has landed in proto3 and proper support for it is implemented in #8 I don't think this makes the API any worse since the end user can simply add theoptional
keyword to their.proto
files and get the same API