Skip to content

Commit

Permalink
Merge pull request #138 from shreyabiradar07/fix_validationError_type…
Browse files Browse the repository at this point in the history
…Mismatch

Adds property_name in the error message for data type mismatch
  • Loading branch information
dinogun authored Jan 10, 2025
2 parents 1d601e9 + 4763b6f commit c2851cb
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit c2851cb

Please sign in to comment.