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

Invalid JVM testcase? Incorrect spec? #50

Open
richard-reece opened this issue Feb 7, 2018 · 5 comments
Open

Invalid JVM testcase? Incorrect spec? #50

richard-reece opened this issue Feb 7, 2018 · 5 comments

Comments

@richard-reece
Copy link

I'm trying to validate a new verifier against the test corpus.

The JVM testcase in the version-2 branch "testcases/response/body/array with regex matcher xml.json" appears to have an invalid JSON path spec according to the pact specification, as it uses "$.body.myDates[*].date['#text']" (the ['#text'] is not valid, according to the spec).

Which is correct, the spec or the test case?

@uglyog
Copy link
Member

uglyog commented Feb 7, 2018

#text is the representation of an XML text node. Because of the hash character, it has to be represented in the [''] form in the path expression, as $.body.myDates[*].date.#text would not be valid.

@richard-reece
Copy link
Author

So I sense you're leaning towards "the test is correct"? :-)

@richard-reece
Copy link
Author

Similarly the version-2 test case request/body/matches with regex with bracket notation.json also has a string element expression, which again isn't mentioned as valid in the spec "All path elements are separated by periods (.), except array indices which use square brackets ([])." If non-index array expressions are allowed, the spec should say so.

@uglyog
Copy link
Member

uglyog commented Feb 9, 2018

The path expressions are based on JSON path, which provides a bracket notation which is needed to escape the attribute names. The spec needs to be updated to include it.

@richard-reece
Copy link
Author

Yep, thanks! :-)

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

No branches or pull requests

2 participants