test-fullautomation / python-jsonpreprocessor

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

Naming convention: Clarification wanted #356

Open HolQue opened 1 week ago

HolQue commented 1 week ago

I would like to understand the naming convention in more detail.

https://github.com/test-fullautomation/python-jsonpreprocessor/issues/206#issuecomment-2244241216

(1)

W.r.t. "Alphanumeric Characters: Use letters (a-z, A-Z) and digits (0-9)."

Also 2, 3 and 4 byte characters are possible in between. Therefore the statement "Use letters (a-z, A-Z)" is outdated. Please update.

(2)

W.r.t. "Key names can contain the operator characters: +, -, and *"

A lot of non alphanumeric characters are not allowed. OK so far. But is there a certain reason, to allow especially +, -, and *? What is the use case? It would be worth to mention this in documentation.

(3)

How about '/'? This character is not mentioned in naming convention.

"par/am1" : "value" is accepted. OK nor not?

(4)

How about blanks inside key names ("par am" : "value")? Currently this is accepted. OK nor not?

test-fullautomation commented 1 week ago

3) / should be allowed. With this you can build e.g. some hierarchy. 4) blank should be not allowed.

HolQue commented 1 week ago

Definition accepted, access not.

"param/4"   : 10,
"check10"   : ${param/4}

The second line causes:

Expecting ',' delimiter

This needs to be fixed.

HolQue commented 1 week ago

I still stumble about the naming convention like written down in https://github.com/test-fullautomation/python-jsonpreprocessor/issues/206#issuecomment-2244241216

There is a lot of redundancy and not all aspects are clarified. After thinking about, this is my version now:

Any other character than letters, digits and _ + - * / are not allowed in key names!

Open questions:

(1)

How to handle leading and trailing blanks or tabs (allowed in pure JSON, but not preferred)?

"keyname  "   : "value"
"  keyname"   : "value"
"  keyname  " : "value"

Shall this cause an error or shall the JsonPreprocessor automatically make a conversion to:

"keyname" : "value"

in such a case?

(2)

How to handle the backslash? Is allowed in pure JSON, but must be masked. Therefore this should be allowed in general:

"path\\to\\file" : "C:\\Users\\Example\\file.txt"

But JsonPreprocessor throws an error. Is there a certain reason for the JsonPreprocessor to deviate from JSON standard here?

HolQue commented 1 week ago

Reworked version: