3 ms·
Tricky part about implementing that is that the protobuf wire-format alone doesn't contain enough information to unambiguously represent the real data types, it
by matja 5y ago
Tricky part about implementing that is that the protobuf wire-format alone doesn't contain enough information to unambiguously represent the real data types, it also needs the schema (.proto file) to do that.
For example, in the wire-format, a string and a sub-message are encoded as the same type (a blob - varint + sequence of bytes), but using the schema they are clearly interpreted differently.
Sure, it is possible to make a self-describing protobuf message which includes the schema in protobuf representation, but that is a special-case.
- uDontKnowMe 5y agoWhat about Avro then?
- Too 5y agoJson schema has a similar challenge, there is no header, in the json files themselves, indicating which schema is used. The slightly dirty solution is https://www.schemastore.org/json/ https://www.schemastore.org/json/, where the IDE looks up schema from a global registry, using a fileMatch pattern.