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

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

Hey @spaceflight-cosmolo1!

There are a few limitations when working with โ€œAnyโ€ fields in our gRPC client. Could you please open an issue on GitHub with all the relevant details to help us track and triage this?

Thanks!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.