Skip to content

Embedded messages are not merged when there is multiple instances of the field in ByteArray #3537

@samulironkko

Description

@samulironkko

It seems that embedded messages are not merged when ByteArray contains multiples instances of the same field. The last value found is accepted like it would be in case of numeric types or strings.

This can be reproduced with the following protobuf

syntax = "proto2";

message SubMessage {
    repeated uint32 repeated_values = 1 [packed = true];
}

message BugMessage {
    optional SubMessage sub_message = 1;
}

And by decoding the following ByteArray that contains 2 instances of SubMessage with 1 repeated value in each instance. The bugMessage should contain SubMessage with 2 repeated values but it only contains the last one.

val bugMessage = BugMessage.ADAPTER.decode(byteArrayOf(10, 3, 10, 1, 1, 10, 3, 10, 1, 1))

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions