Having this proto3 schema on a PHP client and Python server:
service GetAnimalData{
rpc GetData (AnimalRequest) returns (AnimalData) {}
}
message AnimalRequest {
OneOfAnimal TypeAnimal = 1;
}
message AnimalData {
repeated int32 data = 1;
}
message OneOfAnimal {
oneof animal_oneof {
CAT cat = 1;
DOG dog = 2;
}
}
message CAT{
int32 p = 1;
int32 d = 2;
int32 q = 3;
}
message DOG{
int32 p = 1;
int32 d = 2;
int32 q = 3;
int32 p2 = 4;
int32 d2 = 5;
int32 q2 = 6;
}
In oder to set up a request from the PHP client, I need to do:
- Create a new
CAT
- Set
OneOfAnimal
asCAT
- Set
AnimalRequest.TypeAnimal
asOneOfAnimal
Is there a schema for proto3 where I can just set either a CAT
or DOG
object directly as my AnimalRequest.TypeAnimal