mapbox / mapbox/mapbox-gl-js

Can mapbox-gl-style-spec 'isExpression' tell 'Filter syntax' from 'expression'?

Open
#7,704 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

api :memo:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-style-spec version**: 13.3.0

### Question

I am trying to use `expression.isExpression(exp)` to determine whether an `exp` is an `Expression`. If not I need to do some other logical operations. But while I am trying to pass an [`filter syntax`](https://www.mapbox.com/mapbox-gl-js/style-spec/#other-filter) to `isExpression()`(like `["==", "color", "blue"]`), it returns `true`. Ideally, for `filter syntax` I hope `isExpression` return false, then I can do another process to deal with `filter syntax`(The different is in expression if you want use property from tiles you should put the key after get, like `['get','key']` but in filter syntax you don't need `get`). Could this be a bug?

### Links to related documentation

[Filter (deprecated syntax)](https://www.mapbox.com/mapbox-gl-js/style-spec/#other-filter)

cc w/ @springmeyer

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mapbox-gl-style-spec 13.3.0's expression.isExpression entry point and compare its behavior with the linked filter syntax documentation. Determine whether distinguishing filter syntax from expressions is intended, then document or specify the expected behavior and add coverage if an implementation change is warranted.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.