-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate v6 filter syntax (fixes #1)
- Loading branch information
1 parent
d9a938e
commit 0406c27
Showing
4 changed files
with
183 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"version": 6, | ||
"sources": { | ||
"source": { | ||
"type": "vector", | ||
"url": "mapbox://mapbox.mapbox-streets-v5" | ||
} | ||
}, | ||
"layers": [ | ||
{ | ||
"id": "not-array", | ||
"type": "line", | ||
"source": "source", | ||
"filter": {} | ||
}, | ||
{ | ||
"id": "zero-elements", | ||
"type": "line", | ||
"source": "source", | ||
"filter": [] | ||
}, | ||
{ | ||
"id": "invalid-operator", | ||
"type": "line", | ||
"source": "source", | ||
"filter": [ | ||
"=", | ||
"key", | ||
"value" | ||
] | ||
}, | ||
{ | ||
"id": "missing-key", | ||
"type": "line", | ||
"source": "source", | ||
"filter": ["=="] | ||
}, | ||
{ | ||
"id": "missing-value", | ||
"type": "line", | ||
"source": "source", | ||
"filter": [ | ||
"==", | ||
"key" | ||
] | ||
}, | ||
{ | ||
"id": "invalid-key", | ||
"type": "line", | ||
"source": "source", | ||
"filter": [ | ||
"==", | ||
1, | ||
"value" | ||
] | ||
}, | ||
{ | ||
"id": "invalid-value", | ||
"type": "line", | ||
"source": "source", | ||
"filter": [ | ||
"==", | ||
"key", | ||
[] | ||
] | ||
}, | ||
{ | ||
"id": "invalid-type", | ||
"type": "line", | ||
"source": "source", | ||
"filter": [ | ||
"==", | ||
"$type", | ||
"value" | ||
] | ||
}, | ||
{ | ||
"id": "invalid-nested-filter", | ||
"type": "line", | ||
"source": "source", | ||
"filter": [ | ||
"any", | ||
[] | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[ | ||
{ | ||
"line": 14, | ||
"message": "layers[0].filter: array expected, object found" | ||
}, | ||
{ | ||
"line": 20, | ||
"message": "layers[1].filter: filter array must have at least 1 element" | ||
}, | ||
{ | ||
"line": 27, | ||
"message": "layers[2].filter[0]: expected one of [==, !=, >, >=, <, <=, in, !in, all, any, none], = found" | ||
}, | ||
{ | ||
"line": 36, | ||
"message": "layers[3].filter: filter array for operator \"==\" must have 3 elements" | ||
}, | ||
{ | ||
"line": 42, | ||
"message": "layers[4].filter: filter array for operator \"==\" must have 3 elements" | ||
}, | ||
{ | ||
"line": 53, | ||
"message": "layers[5].filter[1]: string expected, number found" | ||
}, | ||
{ | ||
"line": 64, | ||
"message": "layers[6].filter[2]: string, number, or boolean expected, array found" | ||
}, | ||
{ | ||
"line": 74, | ||
"message": "layers[7].filter[2]: expected one of [Point, LineString, Polygon], value found" | ||
}, | ||
{ | ||
"line": 83, | ||
"message": "layers[8].filter[1]: filter array must have at least 1 element" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters