Skip to content

Commit 308b763

Browse files
krehermannCopilot
andcommitted
Update operations/validation.go
Co-authored-by: Copilot <[email protected]>
1 parent 796c406 commit 308b763

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

operations/validation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func IsSerializable(lggr logger.Logger, v any) bool {
3030

3131
func isProtoMessage(v reflect.Value) bool {
3232
protoMsgType := reflect.TypeOf((*proto.Message)(nil)).Elem()
33-
return v.Type().Implements(protoMsgType)
33+
return v.Type().Implements(protoMsgType) || reflect.PointerTo(v.Type()).Implements(protoMsgType)
3434
}
3535

3636
func isValueSerializable(lggr logger.Logger, v reflect.Value) bool {

operations/validation_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func Test_IsSerializable(t *testing.T) {
154154
want: true,
155155
},
156156
{
157-
name: "should serialize proto message",
157+
name: "should serialize proto message ptr",
158158
// this is arbitrary proto message just to test the code path
159159
v: &pb.AddressReferenceEditResponse{
160160
Record: &pb.AddressReference{
@@ -163,6 +163,16 @@ func Test_IsSerializable(t *testing.T) {
163163
},
164164
want: true,
165165
},
166+
{
167+
name: "should serialize proto message ",
168+
// this is arbitrary proto message just to test the code path
169+
v: pb.AddressReferenceEditResponse{
170+
Record: &pb.AddressReference{
171+
Domain: "anything",
172+
},
173+
},
174+
want: true,
175+
},
166176
}
167177

168178
for _, tt := range tests {

0 commit comments

Comments
 (0)