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
This inconsistency is because setting an empty array to the repeated field deletes the key for that field from the internal message hash (named values). While referencing the field sets the default value of the field back in the internal values hash, which is an empty array.
IMO, when setting the field to an empty array, it should not delete the key from the internal values hash. However, I am open to any other suggestions.
Though, irrespective of the solution, the .to_json (and .to_hash) calls should return consistent results.
The text was updated successfully, but these errors were encountered:
If a proto message has a repeated field and that field is an empty array, the JSON serialization of the proto is inconsistent. Here is an example
This inconsistency is because setting an empty array to the repeated field deletes the key for that field from the internal message hash (named
values
). While referencing the field sets the default value of the field back in the internalvalues
hash, which is an empty array.IMO, when setting the field to an empty array, it should not delete the key from the internal
values
hash. However, I am open to any other suggestions.Though, irrespective of the solution, the
.to_json
(and.to_hash
) calls should return consistent results.The text was updated successfully, but these errors were encountered: