python-betterproto
python-betterproto copied to clipboard
Missing data in proto maps
I have a theoretical proto file message defined as:
message Measurement {
double pressure = 1;
double temperature = 2;
}
message MeasurementMap {
map<string, Measurement> measurements = 1;
}
service WeatherStation {
rpc GetClimate (Empty) returns (MeasurementMap) {}
}
The problem is that if MeasurementMap contains a Measurement with all fields equal to 0, betterproto server replies with something like this:
{
"measurements": [
{
"key": "rpi1",
"value": {
"pressure": 1.01,
"temperature": 25.2,
}
},
{
"key": "rpi2"
}
]
}
Second key does not have any value next to it which makes Postman throw a tantrum about "null value not having pressure field"
For comparison, here is the default behaviour of grpclib, which Postman receives and parses A-OK:
{
"measurement": [
{
"key": "rpi1",
"value": {
"pressure": 1.01,
"temperature": 25.2
}
},
{
"key": "rpi2",
"value": {}
}
]
}
It turns out that this issue is not an issue if reflections (#443) work