test-fullautomation / python-jsonpreprocessor

A preprocessor for json files
Apache License 2.0
2 stars 2 forks source link

List access in dotdict notation does not work #269

Closed HolQue closed 4 weeks ago

HolQue commented 1 month ago

I have an index. I use this index to get a value from a list. This value is an integer. I use this value as index to get a value from a list:

"index"     : 1,
"indexList" : [0,1,2],
"param1"    : ${indexList}[${indexList}[${index}]]

Result:

{'index': 1, 'indexList': [0, 1, 2], 'param1': '1'}

param1 is of data type str. Why this? There is no string conversion involved in the JSON code above.

Expected is integer value 1.

The param1 expression is a nested use of indices. Is it possible to define this in dotdict notation also?

I tried:

"param2" : ${indexList.${indexList.${index}}}

With result:

Expecting value: line 4 column 15 (char 62)'!

I am not sure if the syntax is correct. But the error message is wrong in my opinion. I cannot see where a value is missing.

Cross check with entire expression wrapped in quotes:

"param3" : "${indexList.${indexList.${index}}}"

Result:

{'index': 1, 'indexList': [0, 1, 2], 'param3': '1'}

Interesting: this works. Value of param3 is string '1' now (like expected).

param1 and param2 behavior needs to be fixed.

HolQue commented 1 month ago

Covered by JPP_1500 and JPP_1501

HolQue commented 1 month ago

This is unfortunately a mix of different issues. The first one is still open. The second one is solved.

After the latest bugfixes the first issue can be seen in standard notation and also in dotdict notation. JPP_1500 and JPP_1501 are currently being adapted. For what still does not work, I will write a new issue.

Therefore this issue can be closed.

HolQue commented 1 month ago

Successor:

https://github.com/test-fullautomation/python-jsonpreprocessor/issues/287

test-fullautomation commented 4 weeks ago

integrated in RobotFramework AIO 0.11.0