KeyValueObjectMapping icon indicating copy to clipboard operation
KeyValueObjectMapping copied to clipboard

DCParserConfiguration addArrayMapper doesn't respect different classes for similar attribute name

Open bsideup opened this issue 11 years ago • 3 comments

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?

bsideup avatar Dec 24 '12 11:12 bsideup

Yes, I met the same problem. So the problem existed for 3 years?

firstfan avatar Jun 28 '15 14:06 firstfan

Same problem +1

expkzb avatar Mar 14 '16 03:03 expkzb

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]]]];

ayoze avatar Sep 14 '17 15:09 ayoze