Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios, macos] Fix keypath expressions, json object is parsed incorrectly for nested keypaths. #11959

Merged
merged 2 commits into from
May 23, 2018

Conversation

fabian-guerra
Copy link
Contributor

Fixes #11874

@fabian-guerra fabian-guerra added iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS labels May 21, 2018
@fabian-guerra fabian-guerra self-assigned this May 21, 2018
@fabian-guerra fabian-guerra requested a review from 1ec5 May 21, 2018 16:28
Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the issue below, a changelog entry should be added for this bug fix.

NSArray *expressionObject;
for (NSString *pathComponent in self.keyPath.pathComponents.reverseObjectEnumerator) {
NSMutableArray *expressionObject;
NSArray *keyPath = [self.keyPath componentsSeparatedByString:@"."];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, good catch – I was probably thinking of NSString.stringByDeletingPathExtension here.

if (expressionObject) {
expressionObject = @[@"get", pathComponent, expressionObject];
[expressionObject addObject:@[@"get", pathComponent]];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map.box.gl should become ["get", "gl", ["get", "box", ["get", "map"]]], not ["get", "gl", ["get", "box"], ["get", "map"]].

@fabian-guerra fabian-guerra force-pushed the fabian-keypath-11874 branch 3 times, most recently from 1f5809c to 41fd7c8 Compare May 22, 2018 15:49
@@ -16,6 +16,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT

* Unknown tokens in URLs are now preserved, rather than replaced with an empty string. ([#11787](https://github.com/mapbox/mapbox-gl-native/issues/11787))
* Adjusted when and how the camera transition update and finish callbacks are called, fixing recursion bugs. ([#11614](https://github.com/mapbox/mapbox-gl-native/pull/11614))
* Fixed an issue preventing nested `keyPath` expressions get parsed accordingly to the spec. ([#11959](https://github.com/mapbox/mapbox-gl-native/pull/11959))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: replace keyPath with “key path” so developers don’t think this issue was limited to the +[NSExpression expressionForKeyPath:] initializer.

@fabian-guerra fabian-guerra merged commit 3ea1a70 into master May 23, 2018
@fabian-guerra fabian-guerra deleted the fabian-keypath-11874 branch May 23, 2018 17:21
@friedbunny friedbunny added this to the ios-v4.1.0 milestone Jun 12, 2018
@friedbunny
Copy link
Contributor

Added the ios-v4.1.0 milestone — this change is available starting in ios-v4.1.0-beta.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants