test-fullautomation / python-jsonpreprocessor

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

Error messages (14) #267

Open HolQue opened 1 month ago

HolQue commented 1 month ago

Code:

"intParam" : 1,
${intParam}[1] : 2

Result:

Error: 'Could not set variable '${intParam}[1]' with value '2'! Reason: 'int' object does not support item assignment'!

This is like expected.

Now I exchange the hard coded index 1 by an integer parameter:

"intParam" : 1,
${intParam}[${intParam}] : 2

Result:

Error: 'The implicit creation of data structures based on parameter is not supported. New parameter '1[1]' could not be created by the expression '${intParam}[${intParam}]''!

This is wrong. The second code has nothing to do with implicit creation. Expected is the same error message like in the first code.

This error still looks like an incomplete parsing. In case of expressions like ${X}[Y], both X and Y can be of all data types supported by JSON.

But not all combinations are valid. An integer cannot have an index. A list requires an integer as index, but not a string. And so on.

When expressions like ${X}[Y] are computed, urgently the data types of X and Y need to be considered!