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
264 stars 109 forks source link

Return nil when link data is nil #197

Open MihranDovlatyan opened 6 years ago

MihranDovlatyan commented 6 years ago

In fileprivate func extractToOneRelationship( key: String, from serializedData: JSON, linkedType: ResourceType) -> Resource? function if linkData["data"] is nil, then type becomes equal to linkedType. In next lines if resourceFactory.dispense() or resourceFactory.instantiate() thrown an error on type value, then they will crash on linkedType in catch block.

MihranDovlatyan commented 6 years ago

Please check this Travis fails when data is nil.