Pass type.googleapis.com/google.protobuf.StringValue to pb.Any

Roman
Fri, 26 Jul 2024 14:22:12 +0000
Help Hub

Hello!

Currently I’am having issues with passing a value to an Any field as a part of GRPC request.
Here is my request described in postman window in JSON format:

{
    "filter": {
        "criteria_list": [
            {
                "FilterLabel": "PaymentID",
                "operator": "OPERATOR_EQUAL",
                "operand": {
                        "@type": "type.googleapis.com/google.protobuf.StringValue",
                        "value": "e664008e-5f12-42b5-a717-44f8a4601a7b"
                  }
            }
        ],
        "limit": "0",
        "offset": "0",
        "sort_list": [
            {
                "FilterLabel": "PaymentStatus",
                "sort_direction": "SORT_DIRECTION_ASCENDING"
            }
        ]
    }
}

“operand” field is “google/protobuf/any.proto.Any”. So the idea to pass string values supposes that I pack type.googleapis.com/google.protobuf.StringValue into Any. An ‘Any’ field JSON representation looks like following:

{
    "@type": "type.googleapis.com/google.protobuf.StringValue",
    "value": "my_value"
}

So the problem is that i cannot pass UUID values into ‘value’ field since the postman UI shows next error:

String does not match the pattern of "^([a-zA-Z0-9+/]{4})*([a-zA-Z0-9+/]{2}(==)?|[a-zA-Z0-9+/]{3}=?)?$".
bytes

A string of base64, or an array of numbers between 0 and 255

, whilst I can still pass it via grpc client as usual. I’d really appreciate if you suggest workarounds for my case without changing contract for service.

Postman: Version11.5.0
UI version: 11.5.0-ui-240716-0437
Desktop platform version: 11.5.0
Architecture: arm64
OS platform: OS X 22.6.0

3 posts - 3 participants