I want to add string array in protocol buffer message, which I am not able to do. I have written as below
repeated string data = 1[packed=true];
I got the below error:
[packed = true] can only be specified for repeated primitive fields.
I could able to do it for int arrays with same syntax. I am confused why the string is considered as non-primitive type. Can anyone help me please.? Thanks !!
Refer to the section "Specifying Field Rules" of the the Protobuf Documentation. Essentially, packing only makes sense for numeric fields.
Preserving a quote for prosperity:
For historical reasons, repeated fields of basic numeric types aren't encoded as efficiently as they could be. New code should use the special option [packed=true] to get a more efficient encoding.