Open JuanHattingh opened 10 months ago
Indeed it's a bug, but I've found one more problem.
The filteredItems
in transformer returns an object, not an array, so even if LookInTransformed
evaluation mode was working inside loops, it would try to loop over object properties, thus trying to add name
property more than once, which would result in an error.
I've managed to correct this, but the transformer would have to be like this:
{
"filteredItems": [ "#valueof($.topLevelItems[?(@.selectable == true)])" ],
"summary": {
"#loop($.filteredItems)": {
"name": "#currentvalueatpath($.name)"
}
},
"aliasedItems": "#valueof($..filteredItems)" //only one dot here would work as well
}
Output:
{
"filteredItems": [{
"name": "item2",
"type": "someType",
"selectable": true,
"itemArray": [{
"property1": "item2_value1",
"property2": "item2_value2"
}
]
}
],
"summary": [{
"name": "item2"
}
],
"aliasedItems": [{
"name": "item2",
"type": "someType",
"selectable": true,
"itemArray": [{
"property1": "item2_value1",
"property2": "item2_value2"
}
]
}
]
}
Loops always return an array, that's why the summary
field come as an array.
Whenever I perform a fairly trivial transformation that contains a loop operation over a previous transformed result then it always results in a null evaluation.
Input
Transformer
Actual Output
Expected Output
As you can see from the actual output,
aliasedItems
correctly references the value from a previous transformation by looking in the transformed, however when I use the same selector for the loop enumerationsummary
then it always looks inside of the root (input) object, which of course does not contain the transformed property and never inside the previous transformation, hence the result is always null.