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
What is your use-case and why do you need this feature?
For most properties, the behavior of encodeDefaults or @EncodeDefault is determined by an equals check against the property's default value: If encodeDefaults is false and equals is true, the property doesn't get included when serialized.
For array properties, this doesn't work well, because arrays don't implement content-based equals. Thus, for example, an empty array property value registers as not-equals to the empty array default property value, and the empty array is included in the serialized output.
cashapp/redwood#1395 wants to migrate its public API List properties to Array types, primarily because of performance impact on JS.
Describe the solution you'd like
Support content-based rather than reference-based comparison when determining the encodeDefaults behavior for array properties. This could be by default or via a property annotation.
The text was updated successfully, but these errors were encountered:
Given that .equals on arrays aren't as useful, I think the behavior can be changed. Although, it has to be a bugfix in compiler plugin, so it will take some time until it's available in the Kotlin release
What is your use-case and why do you need this feature?
For most properties, the behavior of
encodeDefaults
or@EncodeDefault
is determined by anequals
check against the property's default value: IfencodeDefaults
is false andequals
is true, the property doesn't get included when serialized.For array properties, this doesn't work well, because arrays don't implement content-based
equals
. Thus, for example, an empty array property value registers as not-equals to the empty array default property value, and the empty array is included in the serialized output.cashapp/redwood#1395 wants to migrate its public API
List
properties toArray
types, primarily because of performance impact on JS.Describe the solution you'd like
Support content-based rather than reference-based comparison when determining the
encodeDefaults
behavior for array properties. This could be by default or via a property annotation.The text was updated successfully, but these errors were encountered: