Perhaps keys could also be of all the allowed types as values?
Instead of:
message HashMapStringValue {
map<string, Value> fields = 1;
}
we would use
message HashMapValueValue {
map<Value, Value> fields = 1;
}
Or perhaps that could be a separate class/project?