File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,11 @@ + (void)set:(NSObject <JSONAPIResource> *)resource withDictionary:dictionary {
203
203
[resource setValue: [JSONAPIResourceParser jsonAPILink: value] forKey: key];
204
204
}
205
205
206
+ } else if (relationships[key]) {
207
+ if (relationships) {
208
+ id value = relationships[key];
209
+ [resource setValue: [JSONAPIResourceParser jsonAPILink: value] forKey: key];
210
+ }
206
211
} else {
207
212
id value = [attributes objectForKey: [property jsonName ]];;
208
213
if ((id )[NSNull null ] == value) {
@@ -270,10 +275,17 @@ + (void)link:(NSObject <JSONAPIResource>*)resource withIncluded:(JSONAPI*)jsonAP
270
275
for (NSString *key in properties) {
271
276
JSONAPIPropertyDescriptor *propertyDescriptor = [properties objectForKey: key];
272
277
id value = [resource valueForKey: key];
273
- id includedValue = included[[[propertyDescriptor.resourceType descriptor ] type ]];
278
+
279
+ Class valueClass = nil ;
280
+ if (propertyDescriptor.resourceType ) {
281
+ valueClass = propertyDescriptor.resourceType ;
282
+ } else if ([value conformsToProtocol: @protocol (JSONAPIResource)]) {
283
+ valueClass = [value class ];
284
+ }
285
+ id includedValue = included[[[valueClass descriptor ] type ]];
274
286
275
287
// ordinary attribute
276
- if (propertyDescriptor. resourceType == nil ) {
288
+ if (valueClass == nil ) {
277
289
continue ;
278
290
// has many
279
291
} else if ([value isKindOfClass: [NSArray class ]]) {
You can’t perform that action at this time.
0 commit comments