grpc-ecosystem/grpc-gateway

Support mapping request body to map type

Open

#765 opened on Oct 2, 2018

View on GitHub
 (8 comments) (0 reactions) (0 assignees)Go (16,971 stars) (2,250 forks)batch import
enhancementhelp wantedwaiting on reporter

Description

Is there a way tomap the message body to a keyed map? I.e. with a proto definition containing:

    rpc UpdateConfig (ServiceConfig) returns (OpResult) {
        option (google.api.http) = {
			post: "/v1/robotctl/services/configure"
			body: "config"
		};
    }

message ServiceConfig {
    ServicesReq services            = 1;
    map<string, string> config                   = 2;
}

The idea being that the body of the received message would map to a key in the, eg map<config, body_of_message>

Currently on compiling for grpc-gateway, the following error is thrown - which is odd given that there is no repeated element:

--grpc-gateway_out: repeated field not allowed in field path: config in config

Contributor guide