3 ms·
Required fields are bad; don't use them. You should be very careful about marking fields as required. If at some point you wish to stop writing or sending a re
by tantalor 10y ago
Required fields are bad; don't use them.
You should be very careful about marking fields as required. If at some point you wish to stop writing or sending a required field, it will be problematic to change the field to an optional field – old readers will consider messages without this field to be incomplete and may reject or drop them unintentionally. You should consider writing application-specific custom validation routines for your buffers instead.
https://developers.google.com/protocol-buffers/docs/proto#specifying-field-rules https://developers.google.com/protocol-buffers/docs/proto#sp...
- lmm 10y agoThey're a tradeoff. Sometimes you really are confident enough that this attribute will be required forever that the saving of not having to write custom validation is worth it.