grpc-ecosystem/grpc-gateway

Support mapping request body to map type

开放

#765 创建于 2018年10月2日

 (8 条评论) (0 个反应) (0 位负责人)Go (2,250 个派生)batch import
enhancementhelp wantedwaiting on reporter

仓库指标

星标
 (16,971 个星标)
PR 合并指标
 (平均合并 8天 23小时) (30 天内合并 147 个 PR)

描述

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

贡献者指南