We do this at my work, it works fine. Much better than JSON and skips the insanity of YAML. And it’s nice to have a commented definition file for what is expected/valid in the config.
I’m not clear why this recommends using required on everything - I though protobuf v3 had removed that and made everything default to 0 (or equivalent) if not present on the wire.
I might be an outlier here, but except when data size is a real constraint, I tend to favor XML. (ToML being a good contender, but I don't have enough real-life experience with it yet)
Anyone who actually knows protobuf knows this is a comically bad idea. Protobuf is not self describing, and even the types are ambiguous. And pointlessly ambiguous. The spec itself admits that they have two extra bits in the wire format, either one could be used to identify embedded messages.
As someone who wrote a protobuf parser,
Please don't use protobuf for anything, ever.
I'm not convinced. The ASCII representation looks human readable to me, and the associated .proto definitions will make it easy to parse in any language you want. Wire format doesn't sound relevant to the plaintext representation (or am I wrong?).
I've never tried it - and I don't plan to any time soon - but it doesn't sound like a terrible idea. At least it's typed and you get a parser for free.
‘’’
But, hey, if you're already paying the price of using protobuf in your projects for some other reason, then why not use it for config storage, too?
‘’’
seems, imo, to be the most important point. otherwise, using it as a config replacement seems suspect.
If you don't need fancier types or features than what JSON provides you can use JSON for your config and use protobuf to parse it directly.
Used this for a large, semi-generated config file (think large device trees). File was generated once and then there was some light manual editing after. JSON + pb worked great.
https://protobuf.dev/reference/protobuf/textformat-spec/