I am trying to serialize a SyncRewardDataRequestModel in my response body. "an_id" serializes fine. However, the SyncRewardDataInputModel objects within the NSArray always serializes to a empty NSArray. I have confirmed that I am passing a correct value in my NSArray - Does anyone see what is incorrect with my mapping?
Classes:
@interface SyncRewardDataInputModel : NSObject
@property (nonatomic,copy) NSNumber *test_id;
@end
@interface SyncRewardDataRequestModel : NSObject
@property (nonatomic,strong) NSArray *syncRewardDataInputs;
@property (nonatomic,copy) NSNumber *an_id;
@end
The following is my response descriptor:
//Populate mapping
RKObjectMapping *requestMapping = [RKObjectMapping requestMapping]; // objectClass == NSMutableDictionary
[requestMapping addAttributeMappingsFromDictionary:@{@"an_id": @"an_id"}];
RKObjectMapping *syncRewardDataInputsMapping = [RKObjectMapping mappingForClass:[SyncRewardDataInputModel class]];
[syncRewardDataInputsMapping addAttributeMappingsFromDictionary:@{@"test_id": @"test_id"}];
//Combine
RKRelationshipMapping *arrayRelation = [RKRelationshipMapping relationshipMappingFromKeyPath:@"syncRewardDataInputs" toKeyPath:@"downloadCardResponseDTOs" withMapping:syncRewardDataInputsMapping];
[requestMapping addPropertyMapping:arrayRelation];
//Put it in a request
RKRequestDescriptor *requestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:requestMapping objectClass:[SyncRewardDataRequestModel class] rootKeyPath:nil method:RKRequestMethodAny];
return requestDescriptor;