Protobuf message itself is a map vs. message has an element that is a map

Viewed 702

When defining a proto file, how can one specify if the whole message is a map<string, uint64> or if it contains an element that is a map<string, uint64>. So for example, how do you write a proto for

{
    "abc": 1243,
    "def": 2343
}

Where the keys are arbitrary and you don't know them beforehand, vs.

{
    "foo": {
        "abc": 1243,
        "def": 2343
    }
}

I assume the latter would be:

syntax = "proto3";

message Result {
    map<string, uint64> foo = 1;
}

But how do you define the first then?

1 Answers
Related