KeyValueObjectMapping
KeyValueObjectMapping copied to clipboard
DCParserConfiguration addArrayMapper doesn't respect different classes for similar attribute name
My code looks something like this:
static DCParserConfiguration config;
if ( !config )
{
config = [DCParserConfiguration configuration];
[config addArrayMapper:[DCArrayMapping mapperForClassElements:[UnicomAPIProposalsResponseProposal class]
forAttribute:@"results"
onClass:[UnicomAPIProposalsResponse class]]];
[config addArrayMapper:[DCArrayMapping mapperForClassElements:[UnicomAPIBankProposalsResponseBank class]
forAttribute:@"results"
onClass:[UnicomAPIBankProposalsResponse class]]];
}
pFunction( resultClass ? [[DCKeyValueObjectMapping mapperForClass:resultClass andConfiguration:config] parseDictionary:responseObject] : responseObject );
...
But results of UnicomAPIBankProposalsResponse becomes UnicomAPIProposalsResponseProposal instead of UnicomAPIBankProposalsResponseBank!
WAIDW?
Yes, I met the same problem. So the problem existed for 3 years?
Same problem +1
Just to throw some light on this issue... I had the same problem but ended up to "fix" it with this approach (yes, changing one of the field names) and:
[configuration addArrayMapper:[DCArrayMapping mapperForClass:[GameDescriptorBetType class] onMapping:[DCObjectMapping mapKeyPath:@"types" toAttribute:@"fields" onClass:[GameDescriptorBet class]]]];