Fix keypath regression #265

Closed
wants to merge 2 commits into
from

Projects

None yet

2 participants

@dcordero

Accept NSArray as a valid JSON Object to fix the regression #257

/cc @robb

@robb
Mantle member

Thanks for looking into this

However, also allowing NSArray somewhat defeats the purpose of #230 which was to catch crashes when resolving invalid keypaths due to unexpected JSON responses.

Consider the MTLArrayTestModel in the spec:

@implementation MTLArrayTestModel

+ (NSDictionary *)JSONKeyPathsByPropertyKey {
   return @{
       @"names": @"users.name"
   };
}

+@end

If the server returned JSON like this

{
    "users": [
        "dcordero",
        "robb"
    ]
}

we'd still crash with an NSUnknownKeyException since NSString is not key value coding-compliant for the key name.

@robb robb referenced this pull request Mar 9, 2014
Merged

Keypath regression #266

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment