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
Both of the above serializable classes can be used to deserialize the XML file without any error being thrown. However, the first one silently ignores the repeated elements. This is an issue when I need to make sure I am not ignoring any data.
The default configuration throws exceptions if an element in the XML is not found in the serializable class. Therefore, users are made to epect that this library ensures data is not being ignored. However, in this case it is.
Is there a configuration option that can make it so errors are thrown when a repeated element is found but the property is not set as a list? And if so, perhaps this should be enabled by default.
The text was updated successfully, but these errors were encountered:
I've added an option to deal with this in dev (there is an extra function/option in the policy). In principle however it is somewhat up to the serializer to deal with duplicate values of its elements, but as presence of elements was already tracked to handle null values it was easy to implement. The new property in the policy is: throwOnRepeatedElement.
If I am deserializing an XML file that has repeated element types, I can set the kotlin property to either be a single instance or a list.
In kotlin, I can use:
or
Both of the above serializable classes can be used to deserialize the XML file without any error being thrown. However, the first one silently ignores the repeated elements. This is an issue when I need to make sure I am not ignoring any data.
The default configuration throws exceptions if an element in the XML is not found in the serializable class. Therefore, users are made to epect that this library ensures data is not being ignored. However, in this case it is.
Is there a configuration option that can make it so errors are thrown when a repeated element is found but the property is not set as a list? And if so, perhaps this should be enabled by default.
The text was updated successfully, but these errors were encountered: