Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[style-spec] expose convertFilter API #8493

Merged
merged 1 commit into from
Jul 16, 2019
Merged

Conversation

springmeyer
Copy link
Contributor

@springmeyer springmeyer commented Jul 16, 2019

This PR exposes the convertFilter at

export default function convertFilter(filter: FilterSpecification): mixed {

I need this exposed to be able to auto-upgrade legacy filters in a downstream module that uses require('@mapbox/mapbox-gl-style-spec') (mapbox/vtshaver#30)

The larger context is that I need to combine multiple filters into one array to pass them to gl-native. However gl-native cannot cope with mixing legacy filters (see https://docs.mapbox.com/mapbox-gl-js/style-spec/other/) and new style expressions. Previously it crashed and now it throws (mapbox/mapbox-gl-native#12065). But ideally, through auto-upgrading using this newly exposed function, I can avoid gl-native throwing.

Thanks @samanpwbb and @mapbox/studio for recommending this fix.

Copy link
Contributor

@asheemmamoowala asheemmamoowala left a comment

Choose a reason for hiding this comment

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

Can you please add unit tests in /test/style-spec?

Copy link
Contributor

@ansis ansis left a comment

Choose a reason for hiding this comment

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

Looks good to me! If we merge this today it should make it into the next release.

Copy link
Contributor

@asheemmamoowala asheemmamoowala left a comment

Choose a reason for hiding this comment

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

Looks like there are already unit tests for this in test/unit/style-spec/feature_filter.test.js

@springmeyer springmeyer merged commit 0bd3ea6 into master Jul 16, 2019
@springmeyer springmeyer deleted the feature_filter.convert branch July 16, 2019 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants