Create FileDescriptor from CodeGeneratorRequest

37 views
Skip to first unread message

Jose Gutierrez de la Concha

unread,
Aug 10, 2023, 5:04:47 AM8/10/23
to Protocol Buffers
Hi,


I'm using this C# code to create a FileDescriptor from CodeGeneratorRequest:

using var stdin = Console.OpenStandardInput();
var request = new CodeGeneratorRequest();
request.MergeFrom(stdin);

var protos = new List<ByteString>();
foreach (var proto in request.ProtoFile)
{
    protos.Add(proto.ToByteString());
}
var descritors = FileDescriptor.BuildFromByteStrings(protos);

Is there a better way to do this? The problem with this approach is that I end up decoding encoding and decoding again each FileDescriptorProto
Reply all
Reply to author
Forward
0 new messages