Skip to content

[ 2440282 ] Empty key names #425

@HolQue

Description

@HolQue

Some issues ago I proposed to handle key names containing blanks only, as empty names (that are not allowed). This still makes sense for me and is implemented properly.

But with the new 'keyPattern' parameter I can do this:

json_preprocessor = CJsonPreprocessor(keyPattern = " ")

and

" " : 2

Result:

Error: 'Error: Key name '' is invalid. Expected format: ' ''!

All is implemented like discussed, but nevertheless this result looks a bit strange.

I propose to make sure that the handling of blanks is aligned in the regular expressions and in key names.

I see two possibilities to handle this:

(1)

Similar to #424 we can handle

keyPattern = " "

as not supported and raise an exception.

(2)

The JsonPreprocessor must not execute a strip() on key names any more. But I have doubts that it makes sense to allow key names like " ".

Seems that we need a naming convention for user defined naming conventions.

Metadata

Metadata

Assignees

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions