I'm using gRPC
in Google CLoud Endpoints I'm using quick example for endpoint python
I addition one function for SayHelloRepeated
but don't know how to transcode repeated field.
helloworld.proto
service Greeter {
...
rpc SayHelloRepeated (RepeatedHello) returns (HelloReply) {}
...
}
message RepeatedHello {
repeated HelloRequest hello_request = 1;
}
message HelloRequest {
string name = 1;
}
api_config_http.yaml
http:
rules:
...
- selector: helloworld.Greeter.SayHelloRepeated
get: /v1/rsayhello/{hello_request}
...
When I try to deploy api_config_http.yaml
it give me error Repeated field not allowed
ERROR: (gcloud.endpoints.services.deploy) INVALID_ARGUMENT: Cannot convert to service config.
kind: ERROR message: "http: repeated field not allowed: reached via \'hello_request\' on message \'helloworld.RepeatedHello\'."
Update
What If HelloRequest
has multiple fields not just the one name
field then what to do.
message HelloRequest {
string name = 1;
string message = 2;
}
As per the official documentation Package google.api:
Each mapping specifies a URL path template and an HTTP method. The path template may refer to one or more fields in the gRPC request message, as long as each field is a non-repeated field with a primitive (non-message) type.
This means that you can't use a repeated field in the gRPC. So, you can't use this exact format for you to use repeated fields.
I would recommend you to check this part of the documentation - gRPC Transcoding - to get more information on how to perform a workaround to achieve the use of repeated fields.
Let me know if the information helped you!