This will be done in RNFDictionaryDataDeserializer through the use of two new values:
collapse
This will be an array, where each item is a dictionary.
Every dictionary will have an array of values to collapse, and the name of the collapsed property
The values in the array can have a keyPath form, so for example userLocation.longitude is a valid value (if at runtime there is no property for the given keyPath, nil will be used or maybe an exception will be thrown).
The name of the collapsed property should instead be simple.
An optional 'targetClass' property can be used as it's also used when specifying deserializers, so that collapsed sets of properties can be deserialized to a model class.
If one needs to collapse a set of collapsed properties to a new object, a nested collapsed definition could be used.
flatten
This will be an array, where each item is a keyPath to flatten.
This means that if I flatten email, userInfo.name, userInfo.surname, these three values will be in the "root" of the dictionary.
Question: is this needed if keyPath support is added to mappings?
This will be done in RNFDictionaryDataDeserializer through the use of two new values:
collapse This will be an array, where each item is a dictionary. Every dictionary will have an array of values to collapse, and the name of the collapsed property The values in the array can have a keyPath form, so for example
userLocation.longitude
is a valid value (if at runtime there is no property for the given keyPath,nil
will be used or maybe an exception will be thrown). The name of the collapsed property should instead be simple. An optional 'targetClass' property can be used as it's also used when specifying deserializers, so that collapsed sets of properties can be deserialized to a model class. If one needs to collapse a set of collapsed properties to a new object, a nested collapsed definition could be used.flatten This will be an array, where each item is a keyPath to flatten. This means that if I flatten email, userInfo.name, userInfo.surname, these three values will be in the "root" of the dictionary. Question: is this needed if keyPath support is added to mappings?