wvteijlingen / Spine

A Swift library for working with JSON:API APIs. It supports mapping to custom model classes, fetching, advanced querying, linking and persisting.
MIT License
266 stars 109 forks source link

Fixes PATCH without relationship not fulfilling promise #66

Closed kurko closed 8 years ago

kurko commented 8 years ago

When you do a PATCH and the resource has no relationships, given it's a PATCH, the code for updating relationships is executed, according to the code below:

if self.isNewResource {
  self.result = Failable.Success()
  self.state = .Finished
} else {
  self.updateRelationships()
}

The updateRelationship() method fulfill promises except when the resource has no toOne or toMany relationships (case's default branch).

wvteijlingen commented 8 years ago

Thanks for point this out, but most of the relationship handling has been overhauled in the relationships branch. I do think this bug still exists there though, where updateRelationships never finishes if there are no relationships.

I expect to merge the relationships branch tomorrow, so I'm not going to merge this in now.

kurko commented 8 years ago

:+1: I'm using my fork for the time being.

wvteijlingen commented 8 years ago

I merged in the relationships branch, I think this bug is no longer present there. If you decide to try it and run into it again, let me know.

kurko commented 8 years ago

I'm gonna give it a try and let you know.