We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
struct-tag
validate:omitempty
1 parent ec8439e commit 8be7fa6Copy full SHA for 8be7fa6
rule/struct_tag.go
@@ -843,6 +843,7 @@ var validateSingleOptions = map[string]struct{}{
843
"multibyte": {},
844
"number": {},
845
"numeric": {},
846
+ "omitempty": {},
847
"port": {},
848
"postcode_iso3166_alpha2": {},
849
"postcode_iso3166_alpha2_field": {},
testdata/struct_tag.go
@@ -156,6 +156,7 @@ type MapStruct struct {
156
}
157
158
type ValidateUser struct {
159
+ Id string `validate:"omitempty,min=3,max=32"`
160
Username string `validate:"required,min=3,max=32"`
161
Email string `validate:"required,email"`
162
Password string `validate:"required,min=8,max=32"`
0 commit comments