Skip to content

Commit

Permalink
Enhancement 206 - Update error message of key names validation method.
Browse files Browse the repository at this point in the history
  • Loading branch information
namsonx committed Aug 12, 2024
1 parent a15c21e commit b8dfe72
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions JsonPreprocessor/CJsonPreprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,8 @@ def __keyNameValidation(self, sInput):
if re.match(r'^[\s"]*[\+\-\*:@]+.*$', sInput):
errorMsg = f"Invalid key name: {sInput}. Key names have to start with a character or digit."
elif checkPattern.search(sInput):
errorMsg = f"Invalid key name: {sInput}. Key names must not contain these special characters \"!#$%^&()=[]{{}}|;',?`~\""
errorMsg = f"Invalid key name: {sInput}. Key names must not contain these special characters \"!#$%^&()=[]{{}}|;',?`~\" \
and have to start with a character or digit."
elif re.search(r'\${[^}]*}', sInput):
if re.search(r'\[\s*\]', sInput):
errorMsg = f"Invalid key name: {sInput}. A pair of square brackets is empty!!!"
Expand All @@ -1356,7 +1357,8 @@ def __keyNameValidation(self, sInput):
errorMsg = f"Invalid syntax: Found index or sub-element inside curly brackets in the parameter '{sInput}'"
break
elif checkPattern.search(param[1]):
errorMsg = f"Invalid key name: '{param[1]}' in {sInput}. Key names must not contain these special characters \"!#$%^&()=[]{{}}|;',?`~\""
errorMsg = f"Invalid key name: '{param[1]}' in {sInput}. Key names must not contain these special characters \"!#$%^&()=[]{{}}|;',?`~\" \
and have to start with a character or digit."
break
else:
nestedParam = param[0]
Expand Down

0 comments on commit b8dfe72

Please sign in to comment.