Reputation: 103
I have a .java file created by protoc from a .proto file.
The .proto file no longer exists, is there an existing tool to recreate it from the generated .java file?
Upvotes: 0
Views: 845
Reputation: 6628
In the bottom of the file, you should see a field called descriptorData
which includes the original descriptor of the proto. You cannot directly turn this back into a proto file, but it does contain all the information about how to parse the proto.
If you were so inclined, the format of this data is itself a proto, representing a descriptor.proto
. You can parse this data yourself and reconstruct it, though I don't think there are any tools to do so automatically.
Upvotes: 1