Skip to content

Commit

Permalink
Merge pull request #761 from weichou1229/issue-750
Browse files Browse the repository at this point in the history
feat: Reduce the character restriction of the name field
  • Loading branch information
Lenny Goodell authored Sep 29, 2022
2 parents 1091de3 + 49dcdfb commit f0bb5ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
const (
// Per https://tools.ietf.org/html/rfc3986#section-2.3, unreserved characters= ALPHA / DIGIT / "-" / "." / "_" / "~"
// Also due to names used in topics for Redis Pub/Sub, "."are not allowed
rFC3986UnreservedCharsRegexString = "^[a-zA-Z0-9-_~]+$"
rFC3986UnreservedCharsRegexString = "^[a-zA-Z0-9-_~:;=]+$"
intervalDatetimeLayout = "20060102T150405"
name = "Name"
)
Expand Down Expand Up @@ -95,7 +95,7 @@ func getErrorMessage(e validator.FieldError) string {
case dtoNoneEmptyStringTag:
msg = fmt.Sprintf("%s field should not be empty string", fieldName)
case dtoRFC3986UnreservedCharTag:
msg = fmt.Sprintf("%s field only allows unreserved characters which are ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_~", fieldName)
msg = fmt.Sprintf("%s field only allows unreserved characters which are ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_~:;=", fieldName)
default:
msg = fmt.Sprintf("%s field validation failed on the %s tag", fieldName, tag)
}
Expand Down

0 comments on commit f0bb5ca

Please sign in to comment.