Open Maragues opened 3 months ago
There is indeed no way to do that right now. And although we have a SchemaEncoder
which can somewhat encode a schema into protobuf's descriptor.proto
, there's nothing to decode it.
It's unlikely that we implement something like that before a while unfortunately.
Thanks for the reply. I understand this is a specific need of mine.
No way for your source to expose .proto
. files?
Long story short, a subset of our proto messages are not defined in .proto
files.
Our source of truth is a proto message in protobuf text format. We digest that message and produce N binary files of protobuf types, which are then fed to different platforms for code generation.
I would like to use a binary
DescriptorProto
as input tosourcePath
orprotoPath
Where
first_file.pb
is a serializedDescriptorProto
.I checked Wire's source code and I don't think there's a way to do this right now.
ProtoParser
expects.proto
, and unfortunatelyprotobuf-java
does not support generating.proto
files.Since Wire can generate protobuf-compatible binary files, maybe it isn't too hard to accept binary as input too?
To expand on my use case, I receive a serialized
FileDescriptorSet
as input. Onprotoc
, the call to generate code would beWhere
first_file_name.proto
andsecond_file_name.proto
areDescriptorProto
indata_models.pb
, aFileDescriptorSet
. Whenprotoc
doesn't find a.proto
file in the filesystem, it looks if it exists in any of thedescriptor_set_in
parameters. If there's aFileDescriptorProto
with that name, it generates the code.Thanks!