Skip to content

Comments

Added possibility to watch over multiple children nodes in sub query#35

Merged
joshbuddy merged 8 commits intojoshbuddy:masterfrom
ailjushkin:master
Nov 9, 2015
Merged

Added possibility to watch over multiple children nodes in sub query#35
joshbuddy merged 8 commits intojoshbuddy:masterfrom
ailjushkin:master

Conversation

@ailjushkin
Copy link

Now we are able to select nodes like this:

$.info[?(@.decl.code == 'code1')].values..value

So now @.decl.code can output upper object out of brackets in any level.

@ailjushkin
Copy link
Author

I will check failed tests

@ailjushkin
Copy link
Author

closing to restart travis build

@ailjushkin ailjushkin closed this Sep 29, 2015
@ailjushkin ailjushkin reopened this Sep 29, 2015
@ailjushkin
Copy link
Author

Fixed code to pass all tests

@joshbuddy
Copy link
Owner

Want to write a test case for this as well? Otherwise, seems okay!

@ailjushkin ailjushkin closed this Oct 29, 2015
@ailjushkin ailjushkin reopened this Oct 29, 2015
…10)]: added todo statement to think more about this kind of evals, because hash accessor can return nil and nil cannot be compared with binary operators <>

also fixed tests
@ailjushkin
Copy link
Author

@joshbuddy ready to check :)

@ailjushkin
Copy link
Author

@joshbuddy

explanation to let you understand why that test needs compact function.

  1. I changed example object in tests
  2. I added three books without price parameter - why not?
  3. Then I found that this test failed. And it's failed because reference object created through the collect frunction. In the collect function, we are trying to get prices of books, node['price']. For my new three nodes without price parameters , node['price'] will return nil and output array will look like [1,2,3,nil,nil,nil].
  4. Then look on jsonpath. It's searching for price parameter. Of course, It will never return my new three nodes without price parameter.
  5. To make reference object look like it's output of jsonpath, I added compact function. It removes nil from the array and then the test could be passed.

Other tests were failed because of they are very depended on input data - fixed indexes.
Another test failed because it was comparing by price while filtering in jsonpath.
When jsonpath trying to evaluate @current_node['price'] < 10 on my nodes without price parameter, we get an error, becase @current_node['price'] is nil and nil < 10 not allowed operation. So I wrapped this "as is" eval with rescue.

joshbuddy added a commit that referenced this pull request Nov 9, 2015
Added possibility to watch over multiple children nodes in sub query
@joshbuddy joshbuddy merged commit b82317a into joshbuddy:master Nov 9, 2015
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

Successfully merging this pull request may close these issues.

2 participants