3 ms·
how do you embed comments in protocolbuf data? It's binary! And if you are adding a field specifically for comments, you could do the same in json. For example
by chii 4y ago
how do you embed comments in protocolbuf data? It's binary!
And if you are adding a field specifically for comments, you could do the same in json. For example, a field that has a question mark as the prefix is a comment field (a convention i like).
The advantage of protocol buf is, i think, the version being built in. You can make it backwards compatible to older clients. While the same could be done in json, it's manual and requires work and careful design.
- Rebelgecko 4y ago>how do you embed comments in protocolbuf data? It's binary! In addition to the binary format, every proto message can also be represented in a human readable form[1]. This is not as efficient and probably not a good idea for data being sent over the wire as-is.. especially if it is only being written and read by computers. However if you have small amounts of data at rest (like input for a unit test) it can be handy to add some comments explaining anything non-obvious. On top of that, the proto's schema itself can have comments, and those comments can trickle down into the code generation for a given language so that you can read them when working with your messages. Maybe that's also possible with JSON schemas but idk what their tooling ecosystem is like [1]: https://developers.google.com/protocol-buffers/docs/text-format-spec https://developers.google.com/protocol-buffers/docs/text-for...
- 8n4vidtmkvmk 4y agoprototext supports comments. useful for test data and configurations