Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
dev-docs/RFCs/vNext/json-converter-keyword-handling-rfc.md
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,29 @@ | ||
# RFC: Syntactic sugar for @deck.gl/json | ||
|
||
* **Authors**: Andrew Duberstein (@ajduberstein) | ||
* **Date**: October 10, 2019 | ||
* **Status**: Draft | ||
|
||
|
||
## Overview | ||
|
||
This is a proposal for adding syntactic sugar to the @deck.gl/json expression parser which will let the user distinguish | ||
between the keyword `type` and a string named `type`. | ||
|
||
|
||
## Motivation | ||
|
||
The keyword `type` occurs as a field name in many data sets, and is also of course a Javascript keyword. | ||
Users may want `type` to be interpreted as one or the other but currently can't specify which. | ||
|
||
The GeoJSON standard includes type in the top-level JSON, so most GeoJSON data sets break when ingested by the deck.gl/json API. | ||
|
||
## Prior Art | ||
|
||
We should likely avoid conflicting with [JSON pointer syntax](https://www.baeldung.com/json-pointer) and JSON Paths. It seems like `_`, `__`, and `@@` would be acceptable characters. We are already using `__` in deck.gl to represent internal fields, so it seems like the least ambiguity comes from use of `@@`. | ||
|
||
## Proposal | ||
|
||
deck.gl/json will use `@@type` to indicate the Javascript `type` keyword. | ||
|
||
Additionally, add a syntax for expressions, e.g, `@@=` prefix: `@@=[lng, lat]`, so that we didn't need to know any information about prop types to deduce which strings to parse as expressions. |