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

Support key with '-' in jsonpath is raising an error #1174

Closed
imsVLC opened this issue Jan 17, 2023 · 1 comment · Fixed by #1176
Closed

Support key with '-' in jsonpath is raising an error #1174

imsVLC opened this issue Jan 17, 2023 · 1 comment · Fixed by #1176
Assignees
Labels
bug Something isn't working
Milestone

Comments

@imsVLC
Copy link

imsVLC commented Jan 17, 2023

Hi all,

I'm facing an error when my json support key has a '-'

How to reproduce ?
With this assert block:

[Asserts]
jsonpath "$.data.invoiceaddress" exists
jsonpath "$.data.invoice-address"exists
The first assertion works but the second raises the error:.

jsonpath "$.data.relationships.invoice-address" exists
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the JSONPath expression '$.data.invoice-address" is not valid

Is that a bug or there is something I could do to avoid it?

Thanks in advance!

Regards,

@imsVLC imsVLC added the bug Something isn't working label Jan 17, 2023
@fabricereix
Copy link
Collaborator

Hi @imsVLC ,
Thanks for reporting this bug. We should indeed support - in the dot notation like jsonpath.com.

For the time-being, you can use the bracket notation
jsonpath "$.data.relationships['invoice-address']" exists

@jcamiel jcamiel added this to the 2.0.0 milestone Jan 17, 2023
@fabricereix fabricereix self-assigned this Jan 17, 2023
@fabricereix fabricereix linked a pull request Jan 17, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants