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
JsonPath.read() ignores REQUIRE_PROPERTIES config option when AS_PATH_LIST is set #143
Comments
Forgot to mention, stepping through with the debugger, it is clear that REQUIRE_PROPERTIES is not being set by default. When I submit the ReadContext.read() request, there is only a single config option in the list - AS_PATH_LIST. |
I tried this in version 2.0.0 and 2.1.0 and it works as expected @Test
public void issue_143() {
String json = "{ \"foo\": { \"bar\" : \"val\" }, \"moo\": { \"cow\" : \"val\" } }";
Configuration configuration = Configuration
.builder()
.options( Option.AS_PATH_LIST )
.build();
List<String> pathList = JsonPath
.using(configuration)
.parse(json)
.read("$.*.bar");
assertThat(pathList).containsExactly("$['foo']['bar']");
} What version are you using? |
I am using 2.0.0. |
And the test I provided fails? Sent from my iPhone
|
Yes, this test fails. I had to refactor the assertThat() line to: ...but it does not matter. I get precisely the same Exception and stack trace that I provided in the initial bug description when read() is called. For the record, 'configuration.jsonProvider().getClass().getName()' tells me I am using the com.jayway.jsonpath.spi.json.JsonSmartJsonProvider. |
The test works for me too both from Eclipse and shell. @bradleymorris, how do you run the test? |
I am running the test with a JUnit-natured run configuration in Eclipse. |
I cannot reproduce this. Here's what I do (with current git master):
|
Can not reproduce |
Description
When I specify this (Note: REQUIRE_PROPERTIES is NOT set):
Configuration jsonCfg = Configuration.builder().options( Option.AS_PATH_LIST ).build();
And do this:
Actual Behaviour
I get this:
Expected Behaviour
I expected a
List
result containing a single path:$[foo].[bar]
because I did not have the REQUIRE_PROPERTIES option set. I would only expect to see PathNotFoundException if REQUIRE_PROPERTIES was set.The text was updated successfully, but these errors were encountered: