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
We noticed funny behaviour when trying to deserialize a byte array that was generated from a proto. I understand that default values don't get serialized, and hence deserializing them is not possible. However, I believe that setting up a default value when converting a bytearray to a map would be immensely helpful, instead of having no keys at all and that resulting in a nil.
Let me illustrate this with an example: Assuming you have a Person proto. Considering we are using proto3, I will not be using required and optional.
Now given I have populated a protobuf map of type Person using { :id 123 :name "test subject"}
and serialized it to bytes; Once I try to deserialize it, I get a hashmap of {:id 123 :name "test subject"}
I would instead expect default values to be populated on the resultant map. So; on deserializing, I would expect { :id = 123; :name = "test subject" :email = <empty string> :likes = <empty list> }
Is there something I am missing or is this desired behaviour? If it is something that is by design, would you be happy to accept a patch that allows us to populate default values for the fields not sent on the wire?
The text was updated successfully, but these errors were encountered:
We noticed funny behaviour when trying to deserialize a byte array that was generated from a proto. I understand that default values don't get serialized, and hence deserializing them is not possible. However, I believe that setting up a default value when converting a bytearray to a map would be immensely helpful, instead of having no keys at all and that resulting in a nil.
Let me illustrate this with an example: Assuming you have a Person proto. Considering we are using proto3, I will not be using
required
andoptional
.Now given I have populated a protobuf map of type Person using
{ :id 123 :name "test subject"}
and serialized it to bytes; Once I try to deserialize it, I get a hashmap of
{:id 123 :name "test subject"}
I would instead expect default values to be populated on the resultant map. So; on deserializing, I would expect
{ :id = 123; :name = "test subject" :email = <empty string> :likes = <empty list> }
Is there something I am missing or is this desired behaviour? If it is something that is by design, would you be happy to accept a patch that allows us to populate default values for the fields not sent on the wire?
The text was updated successfully, but these errors were encountered: