You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
When creating a common.Payload and marshaling it into an Any type, the visitor is not able to visit this scenario, due to a missing case *common.Payload in visitPayloads().
This scenario is not used in our API today, but something we may want to support in the future.
Describe the solution you'd like
Implement this base case so we can visit this scenario.
Additional context
Here is a basic test I wrote to validate this new feature
func TestVisitPayloads_AnyPayload(t *testing.T) {
msg, err := anypb.New(inputPayload())
require.NoError(t, err)
root := &protocol.Message{Body: msg}
var anyCount int
err = VisitPayloads(context.Background(), root, VisitPayloadsOptions{
Visitor: func(ctx *VisitPayloadsContext, p []*common.Payload) ([]*common.Payload, error) {
anyCount++
// Only mutate if the payloads has "test"
if len(p) == 1 && string(p[0].Data) == "test" {
return []*common.Payload{{Data: []byte("new-val")}}, nil
}
return p, nil
},
})
require.NoError(t, err)
require.Equal(t, 1, anyCount)
update1, err := root.Body.UnmarshalNew()
require.NoError(t, err)
require.Equal(t, "new-val", string(update1.(*common.Payload).Data))
}
yuandrew
changed the title
Support direct Payload's and Payload`s at top-level of Any in payload visitor
[api-go] Support direct Payload's and Payload`s at top-level of Any in payload visitor
Mar 12, 2025
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
When creating a
common.Payload
and marshaling it into anAny
type, the visitor is not able to visit this scenario, due to a missingcase *common.Payload
invisitPayloads()
.This scenario is not used in our API today, but something we may want to support in the future.
Describe the solution you'd like
Implement this base case so we can visit this scenario.
Additional context
Here is a basic test I wrote to validate this new feature
also see temporalio/api-go#202 (comment) for more context
The text was updated successfully, but these errors were encountered: