Why serialization can't to serialize collection wi...
# serialization
a
Why serialization can't to serialize collection with nullable items in ProtoBuf?
Copy code
@Serializable
data class MyData(val myList: List<String?>)
I found out, that serializer set property
nullableMode = NotNull
, but it is set for list, items in list can be nullable
e
for a non-repeated property, "null" is "missing", but a list is represented by a repeated tag. how do you expect to repeat a missing value in protobuf?
a
hm
e
if you wrote
Copy code
@Serializable
data class NullableString(val value: String? = null)
@Serializable
data class MyData(val myList: List<NullableString>)
it would work but have a different representation, of course
a
got it, thank you, I will find better workaround