Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 1.02 KB

File metadata and controls

29 lines (20 loc) · 1.02 KB

protobuf-decoder

Protobuf-decoder is POC of dynamic decoding of protocol buffer message. It accepts .proto file as an argument together with full message name, reads protobuf message from stdin (in binary format) and writes out this message encoded in JSON.

The dynamic decoding is useful when there's need for programmatically understand and manipulate Protobuf message definitions at runtime - without requiring statically generated code.

Usage:

cat generate-proto-message | go run main.go example/message.proto example.MyMessage

Protobuf compiler can compile the .proto file into serialized format called FileDescriptorSet. It consists of multiple FileDescriptorProto representing the types defined in .proto file.

protoc --descriptor_set_out=message.pb --include_imports example/message.proto

Links