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.
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.