I have a proto message with a structure like this:
syntax = "proto3";
message Bar {
int64 id = 1;
string name = 2;
int64 value = 3;
}
message Msg {
int32 baz = 1;
oneof some_union {
string foo = 2;
Bar bar = 3;
}
}
I could think of two approaches to write yaml equivalent of the message.
In the first approach, see below example, it assigns "some_union": null and no value is set in the field "foo".
baz: 0
foo: "some_string"
In the second approach, see below example, it throws an error saying cannot unmarshal object into Go struct field
baz: 0
some_union:
foo: "some_string"
I am using github.com/ghodss/yaml package for unmarshlling yaml into proto message.