Open HolQue opened 1 month ago
Addendum:
Python:
negindex = -1
listvalues = [1,2,3]
element = listvalues[negindex] # -> result: 3
element = listvalues[-negindex] # -> result: 2
JsonPreprocessor:
"negindex" : -1,
"listvalues" : [1, 2, 3],
"param" : ${listvalues}[${negindex}] // -> result: Error: 'Slicing is not supported!
"param" : ${listvalues}[-${negindex}] // -> result: Error: 'invalid literal for int() with base 10: '--1''!
I wanted to know what happens if I use multiple '
+
' and '-
' operators in indicesIn pure Python it's like this:
The same in JsonPreprocessor (with hard coded index and with parameter as index)
In my opinion it's not a must for the JsonPreprocessor to react in the same way as Python in these cases. But in a lot of cases the index expressions are not resolved completely.
This should be fixed.
Suggestion:
+
' from expressions inside[]
. They must have no effect.-
' is handled as invalid expression or simply consider only the first '-
' on the left hand side of the index (ignoring all further ones).--1
is+1
(- * - = +
) 3.2---1
is-1
(- * - * - = -
)