test-fullautomation / python-jsonpreprocessor

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

Error messages (20) #318

Open HolQue opened 3 weeks ago

HolQue commented 3 weeks ago

Previously this code

{
   ${testdict.subKey.subKey.subKey} : {"A" : 1},
   "subKey" : "B",
   ${testdict.subKey.subKey.subKey}[${subKey}] : "2"
}

caused

'Identified dynamic name of key '${testdict.subKey.subKey.subKey}[${subKey}]' that does not exist. But new keys can only be created based on hard code names.'

That's completely fine.

With latest changes of the JsonPreprocessor the error message changed to:

'Could not set parameter '${testdict.subKey.subKey.subKey}[${subKey}]' with value '2'! Reason: Key error 'B''

Why this change? This makes no sense. It has been decided to limit the "implicit creation" feature to hard coded key names. The usage of parameters is allowed only in case of the key referenced by this parameter, does exist already. The previous error message gives a really good explanation of this rule. The new error message is confusing only.

Please restore the previous one.

namsonx commented 3 weeks ago

Hello Holger,

I'm sorry! This is my mistake when implementing ticket https://github.com/test-fullautomation/python-jsonpreprocessor/issues/301. I had forgotten our implicit creation feature.

I pushed the change to stabi branch to restore the previous error message, I also updated reference selftest logs.

Thank you, Son