jmespath / jmespath/jmespath.js

Fallback parsing of literals as strings is invalid and inconsistent

Open
#90 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
847
Forks
101
PR merge metrics
No merged PRs in 30d

Description

https://jmespath.org/specification.html#grammar and https://jmespath.site/#spec-grammar both require a ``` `…` ``` literal to contain a valid JSON value. ```tokenize('`[x]`')``` accordingly throws a SyntaxError, but expressions like ```tokenize('`x`')``` and ```tokenize('`0x`')``` and ```tokenize('`Infinity`')``` incorrectly return a Literal.

If support for "_the old syntax of allowing elided quotes in JSON literal expressions_" is intentional, then it should be consistent and should also come with a deprecation warning (cf. [JEP-12](https://github.com/jmespath/jmespath.site/blob/master/docs/proposals/raw-string-literals.rst#impact)).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.