Reputation: 187
I want to generate ReST documentation from my .proto definitions. I understand I can do this by writing a C++ plugin for protoc but that's too time-consuming for my current situation. Is there a way to make protoc output a parsed representation of the definitions with comments still included?
I'm using protobuf 3.
Upvotes: 2
Views: 2695
Reputation: 45296
Plugins don't need to be implemented in C++ -- they can be in any language. A plugin is a program that reads a CodeGeneratorRequest
on standard input and then writes a CodeGeneratorResponse
to standard output.
Alternatively, you can also use protoc --include_source_info --descriptor_set_out=FILENAME
to generate a FileDescriptorSet
. Note, though, that this contains somewhat less information than CodeGeneratorRequest
.
Information about comments can be found in FileDescriptorProto.source_code_info
, which has type SourceCodeInfo
. (Note that --descriptor_set_out
strips this information unless you also use --include_source_info
.)
Upvotes: 4