3

I have a request with a field of google.protobuf.Any type. I already checked if my gRPC service is working and I set up the envoy to transcode HTTP/JSON to gRPC. But the envoy keeps giving me an error because of the google.protobuf.Any type. metadata: invalid value Invalid type URL, unknown type: metadata for type Any

I constructed my request in JSON format like the one below. Is anyone know how to format google.protobuf.Any type?

{
    "type": "create",
    "metadata": {
        "@type": "type.googleapis.com/metadata",
        "credentials": {
            "username": "username",
            "password": "password"
        },
        "context": {
            "key": "value"
        }
    }
}
package/credentials.proto
message Credentials {
  string username = 1;
  string password = 2;
}
package/metadata.proto
message Metadata {
  package.Credentials credentials = 1;
  google.protobuf.Struct context = 2;
}
package/service.proto
message CreateOperationRequest {
  string type = 1;
  google.protobuf.Any metadata = 2;
}
Gunwoo Kim
  • 63
  • 8
  • hi. have you got the solution? i'm also confused on how I should write a field with `google.protobuf.Any` type on JSON. I already asked here but no one answered it either. – new line Oct 29 '22 at 17:57

0 Answers0