test-fullautomation / python-jsonpreprocessor

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

Wrong error message w.r.t. dynamic key names #301

Open HolQue opened 2 weeks ago

HolQue commented 2 weeks ago

With

https://github.com/test-fullautomation/python-jsonpreprocessor/pull/296

the behavior of the JsonPreprocessor changed:

The code

"indexP" : 0,
"keyP"   : "A",
"listP"  : ["A", "B"],
${indexP.${keyP}} : "newvalue"

causes:

Error: 'Identified dynamic name of key '${indexP.${keyP}}' that does not exist. But new keys can only be created based on hard code names.'!

Previously the error message was:

'The implicit creation of data structures based on parameter is not supported. New parameter 'indexP['A']' could not be created by the expression '${indexP.${keyP}}''

This old error message is wrong and this is handled in https://github.com/test-fullautomation/python-jsonpreprocessor/issues/267

But the new error message is also wrong. The affected expression is not encapsulated in quotes. Therefore we do not speak here about dynamic key names.

Expected is another error message:

TypeError: 'int' object is not subscriptable