Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming convention: Clarification wanted #356

Open
HolQue opened this issue Oct 24, 2024 · 4 comments
Open

Naming convention: Clarification wanted #356

HolQue opened this issue Oct 24, 2024 · 4 comments
Labels

Comments

@HolQue
Copy link
Collaborator

HolQue commented Oct 24, 2024

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

#206 (comment)

(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
Copy link
Owner

  1. / should be allowed. With this you can build e.g. some hierarchy.
  2. blank should be not allowed.

@HolQue
Copy link
Collaborator Author

HolQue commented Oct 24, 2024

Definition accepted, access not.

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

The second line causes:

Expecting ',' delimiter

This needs to be fixed.

@HolQue
Copy link
Collaborator Author

HolQue commented Oct 25, 2024

I still stumble about the naming convention like written down in #206 (comment)

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

  • Key names can consist of letters, digits and the following special characters: _ + - * /
  • Key names have to start with a letter, a digit or an underscore
  • Key names must not be empty strings. Key names must not contain blanks or tabs only

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
Copy link
Collaborator Author

HolQue commented Oct 28, 2024

Reworked version:

  • Key names can only consist of letters, digits and the following special characters: _ + - * / \ (backslashes are allowed but have to be masked).
  • Key names have to start with a letter, a digit or an underscore.
  • Key names must not be empty strings. But leading and trailing blanks will be removed (and therefore do not cause errors).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants