compilation problem map and protoc 3.0

59 views
Skip to first unread message

Valerio Schiavoni

unread,
Dec 17, 2015, 2:45:00 PM12/17/15
to Protocol Buffers
Hello,

I've defined a simple mini.proto file like this:

syntax = "proto3";
message EncodeRequest{
    required bytes payload = 1;
    maps<string,string> encoding_parameters = 2;
}

The protoc compiler (--version == libprotoc 3.0.0 installed from source from protobuf-python-3.0.0-alpha-3) reports: 

protoc -I . --python_out=. --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_python_plugin` mini.proto
mini.proto:4:13: Expected field name.
Am I doing something particularly wrong ?

Thanks,

Jon Skeet

unread,
Dec 18, 2015, 7:47:03 AM12/18/15
to Protocol Buffers
There are two problems:

- You've misspelled "map" as "maps"
- You've specified a required field, which isn't permitted in proto3.

This works:

syntax = "proto3";
message EncodeRequest{
    bytes payload = 1;
    map<string,string> encoding_parameters = 2;
Reply all
Reply to author
Forward
0 new messages