Skip to content

count filter report errors for valid jsonpath requests (as per RFC 9535) which used to work in v7.*.* #4993

@linkdd

Description

@linkdd

What is the current bug behavior?

count filter report errors for valid jsonpath requests:

{"success":true,"users":[{"name":"guest","roles":null},{"name":"root","roles":["admin"]}]}


error: Filter error
  --> .../acl_users.hurl:17:50
   |
   | GET http://localhost:5080/api/v1/users
   | ...
17 | jsonpath "$.users[?(@.name == 'root')].roles[*]" count == 1
   |                                                  ^^^^^ invalid filter input type
   |                                                           actual:   string
   |                                                           expected: list, bytes or nodeset
   |

error: Filter error
  --> .../acl_users.hurl:19:51
   |
   | GET http://localhost:5080/api/v1/users
   | ...
19 | jsonpath "$.users[?(@.name == 'guest')].roles[*]" count == 0
   |                                                   ^^^^^ missing value to apply filter
   |

Steps to reproduce

GET http://localhost:5080/api/v1/users
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.success" == true
jsonpath "$.users" count == 2
jsonpath "$.users[*].name" contains "root"
jsonpath "$.users[*].name" contains "guest"
jsonpath "$.users[?(@.name == 'root')].roles[*]" count == 1
jsonpath "$..users[?(@.name == 'root')].roles[*]" contains "admin"
jsonpath "$.users[?(@.name == 'guest')].roles[*]" count == 0

Have the endpoint return the following JSON:

{"success":true,"users":[{"name":"guest","roles":null},{"name":"root","roles":["admin"]}]}

What is the expected correct behavior?

Before 8.0.0, it used to work. Using the https://jsonpath.com playground, I can assert that both queries do return a list as per the RFC 9535:

Execution context

  • Hurl Version (hurl --version):
hurl 8.0.0 (unknown) libcurl/8.19.0-DEV OpenSSL/3.5.3 zlib/1.3.1
Features (libcurl):  alt-svc AsynchDNS HSTS IPv6 libz SSL UnixSockets
Features (built-in): brotli

Possible fixes

The new JSONPath implementation was introduced by #4270, maybe it's an upstream bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions