yaml-jsonpath icon indicating copy to clipboard operation
yaml-jsonpath copied to clipboard

Support for recursive descent with expressions and filter expressions

Open rspurgeon opened this issue 2 years ago • 1 comments

Describe the bug

Given the following input:

plugins:
- config:
    do: rae
    foo: bar
  id: 1
  name: abc
- config:
    do: so
    foo: bar
  id: 2
  name: xyz
services:
- name: my-service
  plugins:
  - config:
      do: rae
      foo: special
    id: 3
    name: abc
- name: my-service
  plugins:
  - config:
      do: false
      foo: bar
    id: 4
    name: rst

This selector:

$.plugins[?(@.id<2)]

returns the expected

name: abc
id: 1
config:
  foo: bar
  do: rae

When introducing recursive descent, no results are returned

$..plugins[?(@.id<2)]

Reproduction steps

  1. Launch the web UI from the library
  2. Enter the YAML document from the bug description
  3. Paste in the selector "$..plugins[?(@.id<2)]" and click Execute and view no results
Screenshot 2023-07-21 at 10 18 42 AM Screenshot 2023-07-21 at 10 18 51 AM

Expected behavior

Filters should work with recursive descent according to https://goessner.net/articles/JsonPath/

Additional context

Thank you for this library, any advice on using this library with these features appreciated.

rspurgeon avatar Jul 21 '23 15:07 rspurgeon

I am in the progress of hunting this down this bug to squash it. It is an obstacle to a project I'm currently working on related to my OpenAPI work.

zostay avatar Oct 28 '23 06:10 zostay