It is supported in the proto2 *language*, but you'll need to use a *proto
compiler version* that understands it. Depending on the implementation
(i.e. which language and library you are generating for), you *may* also
need to use a *library* version that has additional features to support
maps.

Note that the binary format does not change between version 2 and version
3, but the proto compiler has changes (to understand the back-ported syntax
changes), and the library may or may not have changes.

Basically, that guidance should be read as:

"You can use map in your proto2 schemas without needing to change to proto3
DSL syntax, but you will need to use an up to data version of protoc and
related tools"


If you can't update your tooling and library versions, then you can still
*read and write* map data. You can just use:

    message MyMapEntry {
        optional int32 key = 1 [default = 0]; // change per your TKey
        optional string value = 2 [default = ""]; // change per your TValue
    }
    repeated MyMapEntry data = 1;

with the slight caveat that it will materialize as a list/array rather than
a native dictionary.

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to