Skip to content

JMESPath let expression with operator in variable binding #690

Description

@BartelNieuwenhuyse

JMESPath expressions with an operator in the expression part of a variable binding (expression between 'let $var=' and 'in') are not parsed correctly.

given:
{"foo": false, "bar": true}

search expression:
let $var = foo || bar in $var

expected:
yields result true

actual:
gives error during evaluation: assertion 'stack.size() == 1' failed

Include a small, self-contained example if possible

TEST_CASE("jmespath let with operator binding expression")
{
    SECTION("Test binary or operator")
    {
        auto doc = jsoncons::json::parse(R"({"foo": false, "bar": true})");
        auto expected = jsoncons::json::parse(R"(true)");

        std::string query = R"(let $op = foo || bar in $op)";
        auto expr = jmespath::make_expression<jsoncons::json>(query);

        jsoncons::json result = expr.evaluate(doc);
        CHECK(expected == result);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions