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

Using != in jsonpath boolean expression leads to syntax error. #3218

Open
msterin opened this issue Sep 6, 2024 · 2 comments
Open

Using != in jsonpath boolean expression leads to syntax error. #3218

msterin opened this issue Sep 6, 2024 · 2 comments
Labels
bug Something isn't working topic: jsonpath

Comments

@msterin
Copy link

msterin commented Sep 6, 2024

What is the current bug behavior?

Using != in jsonpath boolean expression leads to syntax error.

Steps to reproduce

Run hurl with the following file:

POST https://httpbin.org/anything
[
    {
        "projectName": "p1",
        "projectId": 11
    },
    {
        "projectName": "p2",
        "projectId": 21
    }
]
HTTP 200
[Asserts]
#
# expected to pass, passes
jsonpath "$.json[?(@.projectName == 'p2')].projectId" nth 0 == 21
#
# ====> expected to pass, fails with the "JSONPath expression '$.json[?(@.projectName != 'p1')].projectId' is not valid"
#  
jsonpath "$.json[?(@.projectName != 'p1')].projectId" nth 0 == 21

What is the expected correct behavior?

a != b is sexpected to work and generate 'true' when the a != b

Execution context

$ hurl -V
hurl 5.0.1 (x86_64-apple-darwin23.0) libcurl/8.7.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.61.0
Features (libcurl): alt-svc AsynchDNS HSTS HTTP2 IPv6 Largefile libz NTLM SPNEGO SSL UnixSockets
Features (built-in): brotli

Possible fixes

n/a

@msterin msterin added the bug Something isn't working label Sep 6, 2024
@fabricereix
Copy link
Collaborator

Hi @msterin,
The support for JsonPath filter in general is quite limited for the time-being.
There is now a spec that we will try to implement.

@msterin
Copy link
Author

msterin commented Sep 29, 2024

@fabricereix - thanks for the reply. Understood and looking forward for the spec implementation.
Hurl with jsonpath is a great flexible tool , happy to see it's getting better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working topic: jsonpath
Projects
None yet
Development

No branches or pull requests

2 participants