Actions
Bug #18287
closedOnly first element of root array is collected
Pull Request:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
To do
Regression:
Description
If you have a datasource whose API+JSONPath returns:
[ 1, 2 ]
Then only 1
is added in node property.
On the other hand, today we return - as expected:
- api returns { "a": "b" } - JSONPath '$' (select all) - node property is: { "a": "b" }
But as JSONPath always returns an array, we should get
[ {"a":"b"} ]
in node property, which would be extremelly surprising. Moreover, we special case
[]
since it means that the property was not found, and in data sources logic it means that it needs to be removed. Finally, we don't want to break existing code.
So we evolve the rule like that:
Considering JSONPath always returns an array, if JSONPath output is:
- an empty array (and only the root array, this not recursice), we remove the property,
- if the array contains exactly one element, we remove the outmost array and only that one. Note that is means that [:1]
kind of filter will fall in that case.
- if the array has more than one element, we return the array.
Actions