I am using grpc-gateway and I would like to expose an api with the following json response:
{
"id": "123",
"name": "MyItem",
"properties": {
"propA": 1,
"propB": "some value",
"propC": true,
}
}
The values within "properties" are dynamic and not known ahead of time.
So far, my proto definition is:
message Item {
message PropertyValue {
string string_value = 1;
int32 number_value = 2;
bool bool_value = 3;
}
string id = 1;
string name = 2;
map<string, PropertyValue> properties = 3;
}
But this yields a response like this:
{
"id": "123",
"name": "MyItem",
"properties": {
"propA": {
"number_value": 1
},
"propB": {
"string_value": "some value"
},
"propC": {
"bool_value": true
}
}
}
How can I modify my proto so that properties is returned as a json map without the additional typing information?