SEPARATE RESPONSE FOR TEXT PROBLE FORMAT
The Protobuf text format supports comments using the # syntax. I could not find a link to the same in any online documentation, but used the same projects in the past, so I put together a small example that can be checked with:
An example message description is [SampleProtoSchema.proto]
message SampleProtoSchema { optional int32 first_val = 1;
Sample text message - [SampleTextualProto.prototxt]
# This is how textual protobuf format supports comments first_val: 12
Compile and test -
> protoc --python_out=. SampleProtoSchema.proto > > ipython [1]: import SampleProtoSchema_pb2 [2]: sps = SampleProtoSchema_pb2.SampleProtoSchema() [3]: from google.protobuf import text_format [4]: with open('SampleTextualProto.prototxt', 'r') as f: text_format.Merge(f.read(), sps) [5]: sps.first_val [5]> 12 [6]: sps.second_val [6]> 23
OLD ANSWER
The Protobuf message message format supports C / C ++ style comment files using the // syntax.
Check the "Add Comments" section here: https://developers.google.com/protocol-buffers/docs/proto
This may be a newer addition since the question was asked, but it was one of the first links that appear on a Google search, and the answer does not help.
source share