3 ms·
No, it is, at least for C# and the default/"official" code generator. The docs (proto3) say this: “Also note that if a scalar message field is set to its defau
by fuzzy2 4y ago
No, it is, at least for C# and the default/"official" code generator.
The docs (proto3) say this: “Also note that if a scalar message field is set to its default, the value will not be serialized on the wire.”
- tantalor 4y agoThat's true for "singular" fields, but not "optional". https://developers.google.com/protocol-buffers/docs/proto3#specifying_field_rules https://developers.google.com/protocol-buffers/docs/proto3#s... If you don't like that, don't use "singular".
- fuzzy2 4y agooptional or repeated are not semantically correct for a required field though. I’d rather not pollute the contract this way. It doesn’t lend itself to automatically generating documentation from the schema either. Guess I’ll take another look at proto2 then.