I have a project that uses Protobuf but in the future I would like to be able to generate the .proto files from a julia struct. For example I would like to be able to take
struct MyMessage
a::Int32
b::Vector{String}
end
and turn it into
syntax = "proto3";
message MyMessage {
sint32 a = 1;
repeated string b = 2;
}
This seems like it should be a solved problem so I thought it should already exists somewhere and I just didn’t find it.
1 Like
Perplexity says:
If you have existing Julia structs that you want to use with Protocol Buffers, you would need to manually write a corresponding .proto file that matches the structure of your Julia types.
So is it right or wrong?
According my experience you can always generate structs etc from .proto
files, but not the other way round, because structs do not contain all the information .proto
files need.
If you restrict yourself to a subset of the possible ways of doing it, then you could implement such a converter.