gonzalezreal / Groot

From JSON to Core Data and back.
Other
534 stars 61 forks source link

GRTUniquingSerializationStrategy: attribute with null value replaces original value #88

Closed ValentinStrazdin closed 6 years ago

ValentinStrazdin commented 6 years ago

Bug fix: If JSON contains object with "null" attribute, then setting this attribute to existing NSManagedObject will overwrite corresponding attribute value. I have NSManagedObject with identity attribute. This object has several nullable properties. I set values for these properties and save NSManagedObjectContext. When I get JSON from server containing list of objects I want to merge these changes with my existing objects. Although corresponding attributes are null my saved properties are replaced with these nulls.

gonzalezreal commented 6 years ago

Hi @ValentinStrazdin,

Thanks your contribution but, as I mentioned in #86, this is not a bug. If an attribute is explicitly null in the JSON it should overwrite the current value in the database.