-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Regression in JacksonJsonNodeJsonProvider #366
Comments
I can't reproduce the issue. I get the same result with 2.2.0 and 2.3.0. Can you share some more details? |
That's weird. Let me dig further and get back to you. |
Could you try this? import org.junit.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider;
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider;
public class Regression366 {
@Test
public void regression() throws Exception {
JsonNode instance = new ObjectMapper().readTree(
'[' +
" {" +
" \"name\": \"a\"," +
" \"groups\": [{" +
" \"type\": \"phase\"," +
" \"name\": \"alpha\"" +
" }, {" +
" \"type\": \"not_phase\"," +
" \"name\": \"beta\"" +
" }]" +
" }, {" +
" \"name\": \"b\"," +
" \"groups\": [{" +
" \"type\": \"phase\"," +
" \"name\": \"beta\"" +
" }, {" +
" \"type\": \"not_phase\"," +
" \"name\": \"alpha\"" +
" }]" +
" }" +
']');
Configuration jsonPathConf =
Configuration.builder()
.jsonProvider(new JacksonJsonNodeJsonProvider(new ObjectMapper()))
.mappingProvider(new JacksonMappingProvider(new ObjectMapper())).build();
// Should not print '[]'
System.err.println(
JsonPath.parse(instance, jsonPathConf)
.read(JsonPath.compile(
"$[?(@.groups[?(@.type == 'phase' && @.name == 'alpha')] empty false)]"),
JsonNode.class));
}
} |
It seems like the following queries did not regress though:
.. making me guess that there's something going wrong with nested queries. |
It seems to be related to the
yields the same result with 2.2.0 and 2.3.0.
|
fix evaluation of `empty` with wrapping providers (fixes #366)
Thanks a lot for a super quick fix! Any chance of cutting a new release? |
fix evaluation of `empty` with wrapping providers (fixes json-path#366)
Given the following document:
and the following JSON path query:
2.2.0 and 2.3.0 yield different results:
The text was updated successfully, but these errors were encountered: