Closed blork closed 9 years ago
@3squared/developers Anyone have any thoughts on whether this should be added?
I agree the API shouldn't necessary be sanitising data or performing any sort of logic of that sort. However can we think of a scenario where inserting duplicates would be desirable? I think it is more likely for the error case to be the norm.
So on balance, for convenience and to stop nasty, hard to narrow down bugs like this occurring again, we should include your fix in (cdbade916f1856b0fff4be31dde888a507e76cb9).
If you try and insert data with duplicates like this:
Then you will end up with multiple managed objects inserted with the same ID. While this makes sense given the data, it is pretty definitely not what you want, since it's meant to be a unique key.
I have created a fix for this (cdbade916f1856b0fff4be31dde888a507e76cb9), but am not certain if the logic truly belongs in SQKDataKit or should uniqueness of the remote data be the caller's problem?