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

Adds property_name in the error message for data type mismatch #138

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/json_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,11 @@ def validate_trial_generate_json(trial_generate_json):

return errorMsg
except jsonschema.exceptions.ValidationError as err:
# Check if the exception is due to empty or null required parameters and prepare the response accordingly
property_absolute_path = err.absolute_path
property_name = property_absolute_path[1]
# Check if the exception is due to parameters data type mismatch and prepare the response accordingly
if any(word in err.message for word in HPOErrorConstants.JSON_NULL_VALUES):
errorMsg = "Parameters" + HPOErrorConstants.VALUE_MISSING
errorMsg = "Parameter " + property_name + " " + err.message
return errorMsg
# Modify the error response in case of additional properties error
elif str(err.message).__contains__('('):
Expand Down