test-fullautomation / python-jsonpreprocessor

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

Parameter in dotdict expressions: position dependency #194

Closed HolQue closed 3 months ago

HolQue commented 5 months ago

Data structure created implicitly:

${testdict.subKey.subKey.paramA} : "DEF",

Some parameters with name of existing keys:

"keyName_1" : "subKey",
"keyName_2" : "paramA",

Subkeys referenced by parameter:

This works:

${testdict.subKey.subKey.${keyName_2}} : "GHI"

Outcome:

{'keyName_1': 'subKey',
 'keyName_2': 'paramA',
 'testdict': {'subKey': {'subKey': {'paramA': 'GHI'}}}}

This causes an error:

${testdict.subKey.${keyName_1}.paramA} : "GHI"

Outcome:

Error: 'Invalid parameter format: ${testdict.subKey.${keyName_1}.paramA}'!

Seems that the proper outcome of parameters inside dot notation expressions depends on the position of the parameter inside the expression.

Crosscheck with not existing key:

"keyName_3" : "IAMNOTEXISTING",

This works like expected:

${testdict.subKey.subKey.${keyName_3}} : "JKL"

Outcome:

Error: 'The implicit creation of data structures based on nested parameter is not supported. ...

But position issue:

${testdict.subKey.${keyName_3}.paramA} : "JKL"

Outcome:

Error: 'Invalid parameter format: ${testdict.subKey.${keyName_3}.paramA}'!

The expected behavior should be clarified. The outcome should be aligned.

namsonx commented 5 months ago

Hello Holger,

I have just pushed a small change 38baaad1ccdc to stabi branch to fix the bug mentioned in this ticket

Thank you, Son

namsonx commented 5 months ago

Merged to develop branch

test-fullautomation commented 4 months ago

Hi Holger, is your retest successful? Thank you, Thomas

HolQue commented 4 months ago

Retest successful. Issue can be closed.