test-fullautomation / python-jsonpreprocessor

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

Cyclic import detected mistakenly #390

Open HolQue opened 1 week ago

HolQue commented 1 week ago

A file containing common values, is imported

This is detected as 'cyclic import' mistakenly.

But should be possible.

Example:

{
   "root"        : "../",
   "values_AA_1" : {"AA_1_a"   : 1,
                    "[import]" : "${root}global_defs/imported.common.sublevel.jsonp",
                    "AA_1_b"   : 2
                   },
   "values_AA_2" : {"AA_2_a"   : 1,
                    "[import]" : "${root}global_defs/imported.common.sublevel.jsonp",
                    "AA_2_b"   : 2
                   }
}

Result:

Cyclic imported json file '... /dynamic_imports/global_defs/imported.common.sublevel.jsonp'!
In file: '... /dynamic_imports/AA/BB/imported.BB.CSL.jsonp'

Test cases: JPP_1112, JPP_1113 (commented out)

Reference: https://github.com/test-fullautomation/python-jsonpreprocessor/issues/389#issuecomment-2479012648

test-fullautomation commented 1 week ago

Hi @namsonx , please look into this. This would be required for 0.13.1 Files can be multiple times imported, also in different files. Only recursion must be blocked. Thank you, Thomas

namsonx commented 4 days ago

Hello Holger,

This ticket was implemented and pushed to stabi branch, could you help us verify it.

Thank you, Son

HolQue commented 4 days ago

Hi Son,

the error message changed a bit, but the JSON content above still detects a cyclic import.

namsonx commented 3 days ago

Hello Holger,

It was my mistake, I pushed the tiny change to stabi branch to correct it.

Thank you, Son

HolQue commented 3 days ago

Retest successful. Issue can be closed.