-
Notifications
You must be signed in to change notification settings - Fork 60
Description
Even if I searched the repository extensively I couldn't find anything that hints you can do this. The function https://hackage.haskell.org/package/proto3-suite-0.7.0/docs/src/Proto3.Suite.Class.html#message seems to indicate all message fields are constructed using DotProtoMessagePart's with constructor DotProtoMessageField DotProtoField.
I got the impression you should wrap your messages oneof field type in ForceEmit a, but it seems they only accept Primitive a.
I might be rambling here, but this is my take away from digesting the code a bit. If anyone, with insight into the code, think there is a chance to make it possible to model oneof's containing toplevel messages using the current generics based approach (genericDotProto) I could try to champion it with some guidance. I mean accomplishing the below sketchy example
-- MessageX below would map to proto top level messages.
data Message1 = Message1 { fld1 :: OnOff SumType1 }
data SumType1 = A Message2 | B
data Message2 = Message2 { fld1 :: NestedVec Message3 }
data Message3 = Message3 { fld1 :: Int32 }
that would translate into a .proto like (mind my .proto knowledge is very limited)
message Message1 {
oneof fld1 {
string b = 1;
Message2 a = 2;
}
}
message Message2 {
repeated Message3 fld1 = 1;
}
message Message3 {
unsigned fld1 = 1;
}