How to count repeats in a inner field

Following the triggerable evaluation code, it all goes down to how we're contextualizing the triggerable's target refs with the evaluation context's ref. These assertions explain the core of the problem:

TreeReference context = getRef("/data/outer[0]/inner[1]/count[0]");
assertThat(
    getRef("..").contextualize(context),
    is(getRef("/data/outer[0]/inner[1]"))
);
assertThat(
    getRef("../../inner").contextualize(context),
    is(getRef("/data/outer[0]/inner[1]"))
);

I would expect the second result to be /data/outer[0]/inner.

1 Like