Skip to content

Commit

Permalink
Add url validate case to return InvalidParameterError (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
stanleyphu authored Mar 1, 2024
1 parent 0e7d807 commit d7af249
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/service/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ func ValidateStruct(ctx context.Context, obj interface{}) error {
switch ruleName {
case "email":
return NewInvalidParameterError(fieldName, "must be a valid email")
case "url":
return NewInvalidParameterError(fieldName, "must be a valid url")
case "max":
return NewInvalidParameterError(fieldName, fmt.Sprintf("must be less than %s", validationRules[ruleName]))
case "min":
Expand Down

0 comments on commit d7af249

Please sign in to comment.