2017-12-16 7 views
0

gcloudエンドポイント上のgRPC helloworldの例で、HTTP/JSONからgRPCへのトランスコードをセットアップしようとしています。http:bodyフィールドのパス 'foo'は繰り返されないメッセージでなければなりません。 '

service Greeter { 
    // Sends a greeting 
    rpc SayHello (HelloRequest) returns (HelloReply) { 
    option (google.api.http) = { 
     post: "/v1/hello" 
     body: "name" 
    }; 
    } 
} 

と私のサービスの設定は次のとおりです:helloworld.protoファイルへの私の注釈がある

gcloud endpoints services deploy api_descriptor.pb api_config.yaml 

と私が手::

http: 
    rules: 

    - selector: helloworld.Greeter.SayHello 
    post: /v1/hello 
    body: name 

api_descriptor.pbファイルを生成した後、私は実行

ERROR: (gcloud.endpoints.services.deploy) INVALID_ARGUMENT: Cannot convert to service config. 
'ERROR: helloworld/helloworld.proto:43:3: http: body field path 'foo' must be a non-repeated message.' 

ご協力いただければ幸いです。 :)

答えて

0

明らかに、本体は基本タイプではありません。メッセージに名前をラップすると、うまくいきます。

service Greeter { 
    // Sends a greeting 
    rpc SayHello (HelloRequest) returns (HelloReply) { 
    option (google.api.http) = { 
     post: "/v1/hello" 
     body: "person" 
    }; 
    } 
} 

message Person { 
    string name = 1; 
} 

// The request message containing the user's name. 
message HelloRequest { 
    Person person = 1; 
} 
関連する問題