|
|
|
|
|
by txdv
519 days ago
|
|
> Try exposing a grpc api to a browser I remember being grilled for not creating "jsony" interfaces: message Response {
string id = 1;
oneof sub {
SubTypeOne sub_type_one = 2;
SubTypeTwo sub_type_two = 3;
}
} message SubTypeOne {
string field = 1;
} message SubTypeTwo {
} In your current model you just don't have any fields in this subtype, but the response looked like this with our auto translator:
{ "id": "id", "sub_type_two": { } } Functionally, it works, and code written for this will work if new fields appear. However, returning empty objects to signify the type of response is strange in the web world. But when you write the protobuf you might not notice |
|