test-fullautomation / python-jsonpreprocessor

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

Implicit creation - possible expectations and error messages #183

Closed HolQue closed 5 months ago

HolQue commented 5 months ago

This implicit creation feature is really a tricky one. We decided not to support parameters. We request now to use hard coded key names only.

This is fine to me, but I have no idea what might be the intuitive expectation of the users?

This is the code (taken from python-jsonpreprocessor\test\testfiles\jpp-test_config_1001.jsonp)

"paramA" : "ABC",
${param3.subkey.subkey.paramA} : "DEF",

The name of the last implicitly created key within the expression ${param3.subkey.subkey.paramA} is "paramA", and not the value "ABC" of the parameter with the same name ("paramA"). This is like we expect now.

But some doubts are left:

Can we be sure that all users have the same expectation, and no one expects ${param3.subkey.subkey.ABC}?

What will be the impact in case of someone has the wrong expectation?

Is it maybe possible to provide a warning in case of an implicitly created key has the same name like an already existing parameter? Something like:

Duplicate name found ... , parameter ... will not be resolved ..., the name of the parameter is used instead ...

Does such a warning help users to debug their JSON code?

What is the impact on the speed? Will it slow down the JsonPreprocessor too much in case of all keys are compared with the list of all other parameter names?

Maybe it's worth to spend some minutes to think about.

test-fullautomation commented 5 months ago

Code remains as it is. Behaviour will be documented.

HolQue commented 5 months ago

Documentation is updated with

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

test-fullautomation commented 5 months ago

solved with version 0.10.0