jmespath/jmespath.js

Dash should not be treated as a valid character in unquoted identifiers

Closed this issue · 1 comments

According to the spec (and jmespath/jmespath.rb#12),

- is not valid in unquoted identifiers as it is used for negative numbers

But the simulator on the jmespath front page does not complain.

I wasn't familiar with jmespath and tried to build a valid expression, then carried it to the application I wanted to use it with and wondered for some hours why it didn't do what I wanted.

Example:

Expression:
contains(resource_access.monitoring-application.roles[*], 'admin') && 'I am ze admin!'

Document:

{
  "resource_access": {
    "monitoring-application": {
       "roles": [
          "admin"
       ]
    }
  }
}

The above should not be valid, but returns "I am ze admin!".
The go implementation errors out with "SyntaxError: Invalid token: tNumber"

Just saw that this is already addressed in #67