grpc-ecosystem/grpc-gateway

Support mapping request body to map type

Open

#765 创建于 2018年10月2日

在 GitHub 查看
 (8 评论) (0 反应) (0 负责人)Go (16,971 star) (2,250 fork)batch import
enhancementhelp wantedwaiting on reporter

描述

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

贡献者指南