All of my case classes and case objects should be in protobuf. Now I need for them to belong to a single trait.
Sadly this is how I have done:
message WGCommand {
oneof sealed_value {
EnqueueWorkDone enq = 1;
OpenWorkgroup oWg = 3;
}
}
message OpenWorkgroup {}
message EnqueueWorkDone {
required string id = 1;
required string actorRef = 2;
}
This one creates
final case class OpenWorkgroup(){...}
I want my protobuf to produce something like this:
sealed trait WGCommand
case object OpenWorkgroup extends WGCommand
case class EnqueueWorkDone(id:String, actorRef:String) extends WGCommand
I think that what you are asking is how you can make a message with no fields be a case object and not a case class. This is not currently possible, but came up in the past and it's an enhancement that we can consider (see https://github.com/scalapb/ScalaPB/issues/485) - feel free to leave a note on that issue. In the mean time, you can create your own ADT hierarchy and use custom types to convert to and from them.