jsonpath
jsonpath copied to clipboard
Filter with OR expression fails with non-existing value
Adding a test such as the following, fails when a filter contains an OR expression with one of its operands being compared to a none-existing value, e.g.,
Slightly modifying an existing test named op_object_or_default in op.rs:
#[test]
fn op_object_or_nonexisting_default() {
setup();
select_and_then_compare(
"$.friends[?(@.id >= 2 || @.id == 4)]",
read_json("./benchmark/data_obj.json"),
json!([
{ "id" : 2, "name" : "Gray Berry" }
]),
);
}
The selected result is empty, while it should be equal to the target json.
When removing the right operand || @.id == 4 it succeeds
(with filter "$.friends[?(@.id >= 2)]" )