Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not parsing or running path with iterator correctly #1

Open
krisalyssa opened this issue May 22, 2019 · 0 comments
Open

Not parsing or running path with iterator correctly #1

krisalyssa opened this issue May 22, 2019 · 0 comments

Comments

@krisalyssa
Copy link

iex(1)> Jqish.parse(".foo[].bar.baz")
{:error, %Jqish.SyntaxError{before: "iterator", token: nil}}
iex(2)> Jqish.parse(".foo.[].bar.baz")
{:ok, ["foo", :iterator, "bar", "baz"]}
iex(3)> Jqish.run('{"foo":[{"bar":{"baz":"quux"}}]}', ".foo.[].bar.baz")
{:error,
 %Jqish.UnexpectedValueError{
   path: ["foo", :iterator, "bar", "baz"],
   target: '{"foo":[{"bar":{"baz":"quux"}}]}'
 }}
iex(4)> Jqish.parse(".foo|.[].bar.baz")
{:error, %Jqish.SyntaxError{before: nil, token: "|"}}

On the other hand:

$ echo '{"foo":[{"bar":{"baz":"quux"}}]}' | jq ".foo[].bar.baz"
"quux"
$ echo '{"foo":[{"bar":{"baz":"quux"}}]}' | jq ".foo.[].bar.baz"
jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
.foo.[].bar.baz
jq: 1 compile error
$ echo '{"foo":[{"bar":{"baz":"quux"}}]}' | jq ".foo|.[].bar.baz"
"quux"

There appear to be three issues here.

  1. jqish is not successfully parsing syntax it should.
  2. jqish if parsing syntax it shouldn't.
  3. In the latter case, even though it accepts the erroneous syntax, it doesn't run it correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant