build(deps): bump github.com/go-playground/validator/v10
Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.18.0 to 10.19.0. - [Release notes](https://github.com/go-playground/validator/releases) - [Commits](https://github.com/go-playground/validator/compare/v10.18.0...v10.19.0) --- updated-dependencies: - dependency-name: github.com/go-playground/validator/v10 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
7611f70dc5
commit
65f77c2aa0
@@ -41,7 +41,7 @@ require (
|
|||||||
github.com/go-micro/plugins/v4/wrapper/monitoring/prometheus v1.2.0
|
github.com/go-micro/plugins/v4/wrapper/monitoring/prometheus v1.2.0
|
||||||
github.com/go-micro/plugins/v4/wrapper/trace/opentelemetry v1.2.0
|
github.com/go-micro/plugins/v4/wrapper/trace/opentelemetry v1.2.0
|
||||||
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
|
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
|
||||||
github.com/go-playground/validator/v10 v10.18.0
|
github.com/go-playground/validator/v10 v10.19.0
|
||||||
github.com/gofrs/uuid v4.4.0+incompatible
|
github.com/gofrs/uuid v4.4.0+incompatible
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.0
|
github.com/golang-jwt/jwt/v4 v4.5.0
|
||||||
github.com/golang/protobuf v1.5.3
|
github.com/golang/protobuf v1.5.3
|
||||||
|
|||||||
@@ -1236,8 +1236,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
|
|||||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtPsPm2S9NAZ5nl9U=
|
github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4=
|
||||||
github.com/go-playground/validator/v10 v10.18.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||||
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
|
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
|
||||||
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||||
github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
|
github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
|
||||||
|
|||||||
+1
-1
@@ -15,4 +15,4 @@ test:
|
|||||||
bench:
|
bench:
|
||||||
$(GOCMD) test -run=NONE -bench=. -benchmem ./...
|
$(GOCMD) test -run=NONE -bench=. -benchmem ./...
|
||||||
|
|
||||||
.PHONY: test lint linters-install
|
.PHONY: test lint linters-install
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
Package validator
|
Package validator
|
||||||
=================
|
=================
|
||||||
<img align="right" src="logo.png">[](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
<img align="right" src="logo.png">[](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||

|

|
||||||
[](https://travis-ci.org/go-playground/validator)
|
[](https://travis-ci.org/go-playground/validator)
|
||||||
[](https://coveralls.io/github/go-playground/validator?branch=master)
|
[](https://coveralls.io/github/go-playground/validator?branch=master)
|
||||||
[](https://goreportcard.com/report/github.com/go-playground/validator)
|
[](https://goreportcard.com/report/github.com/go-playground/validator)
|
||||||
|
|||||||
+1
-1
@@ -126,7 +126,7 @@ func (v *Validate) extractStructCache(current reflect.Value, sName string) *cStr
|
|||||||
|
|
||||||
fld = typ.Field(i)
|
fld = typ.Field(i)
|
||||||
|
|
||||||
if !fld.Anonymous && len(fld.PkgPath) > 0 {
|
if !v.privateFieldValidation && !fld.Anonymous && len(fld.PkgPath) > 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
@@ -14,3 +14,13 @@ func WithRequiredStructEnabled() Option {
|
|||||||
v.requiredStructEnabled = true
|
v.requiredStructEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithPrivateFieldValidation activates validation for unexported fields via the use of the `unsafe` package.
|
||||||
|
//
|
||||||
|
// By opting into this feature you are acknowledging that you are aware of the risks and accept any current or future
|
||||||
|
// consequences of using this feature.
|
||||||
|
func WithPrivateFieldValidation() Option {
|
||||||
|
return func(v *Validate) {
|
||||||
|
v.privateFieldValidation = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+28
-4
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// per validate construct
|
// per validate construct
|
||||||
@@ -156,7 +157,7 @@ func (v *validate) traverseField(ctx context.Context, parent reflect.Value, curr
|
|||||||
structNs: v.str2,
|
structNs: v.str2,
|
||||||
fieldLen: uint8(len(cf.altName)),
|
fieldLen: uint8(len(cf.altName)),
|
||||||
structfieldLen: uint8(len(cf.name)),
|
structfieldLen: uint8(len(cf.name)),
|
||||||
value: current.Interface(),
|
value: getValue(current),
|
||||||
param: ct.param,
|
param: ct.param,
|
||||||
kind: kind,
|
kind: kind,
|
||||||
typ: current.Type(),
|
typ: current.Type(),
|
||||||
@@ -410,7 +411,7 @@ OUTER:
|
|||||||
structNs: v.str2,
|
structNs: v.str2,
|
||||||
fieldLen: uint8(len(cf.altName)),
|
fieldLen: uint8(len(cf.altName)),
|
||||||
structfieldLen: uint8(len(cf.name)),
|
structfieldLen: uint8(len(cf.name)),
|
||||||
value: current.Interface(),
|
value: getValue(current),
|
||||||
param: ct.param,
|
param: ct.param,
|
||||||
kind: kind,
|
kind: kind,
|
||||||
typ: typ,
|
typ: typ,
|
||||||
@@ -430,7 +431,7 @@ OUTER:
|
|||||||
structNs: v.str2,
|
structNs: v.str2,
|
||||||
fieldLen: uint8(len(cf.altName)),
|
fieldLen: uint8(len(cf.altName)),
|
||||||
structfieldLen: uint8(len(cf.name)),
|
structfieldLen: uint8(len(cf.name)),
|
||||||
value: current.Interface(),
|
value: getValue(current),
|
||||||
param: ct.param,
|
param: ct.param,
|
||||||
kind: kind,
|
kind: kind,
|
||||||
typ: typ,
|
typ: typ,
|
||||||
@@ -470,7 +471,7 @@ OUTER:
|
|||||||
structNs: v.str2,
|
structNs: v.str2,
|
||||||
fieldLen: uint8(len(cf.altName)),
|
fieldLen: uint8(len(cf.altName)),
|
||||||
structfieldLen: uint8(len(cf.name)),
|
structfieldLen: uint8(len(cf.name)),
|
||||||
value: current.Interface(),
|
value: getValue(current),
|
||||||
param: ct.param,
|
param: ct.param,
|
||||||
kind: kind,
|
kind: kind,
|
||||||
typ: typ,
|
typ: typ,
|
||||||
@@ -484,3 +485,26 @@ OUTER:
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getValue(val reflect.Value) interface{} {
|
||||||
|
if val.CanInterface() {
|
||||||
|
return val.Interface()
|
||||||
|
}
|
||||||
|
|
||||||
|
if val.CanAddr() {
|
||||||
|
return reflect.NewAt(val.Type(), unsafe.Pointer(val.UnsafeAddr())).Elem().Interface()
|
||||||
|
}
|
||||||
|
|
||||||
|
switch val.Kind() {
|
||||||
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||||
|
return val.Int()
|
||||||
|
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
||||||
|
return val.Uint()
|
||||||
|
case reflect.Complex64, reflect.Complex128:
|
||||||
|
return val.Complex()
|
||||||
|
case reflect.Float32, reflect.Float64:
|
||||||
|
return val.Float()
|
||||||
|
default:
|
||||||
|
return val.String()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+15
-14
@@ -80,20 +80,21 @@ type internalValidationFuncWrapper struct {
|
|||||||
|
|
||||||
// Validate contains the validator settings and cache
|
// Validate contains the validator settings and cache
|
||||||
type Validate struct {
|
type Validate struct {
|
||||||
tagName string
|
tagName string
|
||||||
pool *sync.Pool
|
pool *sync.Pool
|
||||||
tagNameFunc TagNameFunc
|
tagNameFunc TagNameFunc
|
||||||
structLevelFuncs map[reflect.Type]StructLevelFuncCtx
|
structLevelFuncs map[reflect.Type]StructLevelFuncCtx
|
||||||
customFuncs map[reflect.Type]CustomTypeFunc
|
customFuncs map[reflect.Type]CustomTypeFunc
|
||||||
aliases map[string]string
|
aliases map[string]string
|
||||||
validations map[string]internalValidationFuncWrapper
|
validations map[string]internalValidationFuncWrapper
|
||||||
transTagFunc map[ut.Translator]map[string]TranslationFunc // map[<locale>]map[<tag>]TranslationFunc
|
transTagFunc map[ut.Translator]map[string]TranslationFunc // map[<locale>]map[<tag>]TranslationFunc
|
||||||
rules map[reflect.Type]map[string]string
|
rules map[reflect.Type]map[string]string
|
||||||
tagCache *tagCache
|
tagCache *tagCache
|
||||||
structCache *structCache
|
structCache *structCache
|
||||||
hasCustomFuncs bool
|
hasCustomFuncs bool
|
||||||
hasTagNameFunc bool
|
hasTagNameFunc bool
|
||||||
requiredStructEnabled bool
|
requiredStructEnabled bool
|
||||||
|
privateFieldValidation bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns a new instance of 'validate' with sane defaults.
|
// New returns a new instance of 'validate' with sane defaults.
|
||||||
|
|||||||
Vendored
+1
-1
@@ -979,7 +979,7 @@ github.com/go-playground/locales/en
|
|||||||
# github.com/go-playground/universal-translator v0.18.1
|
# github.com/go-playground/universal-translator v0.18.1
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/go-playground/universal-translator
|
github.com/go-playground/universal-translator
|
||||||
# github.com/go-playground/validator/v10 v10.18.0
|
# github.com/go-playground/validator/v10 v10.19.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/go-playground/validator/v10
|
github.com/go-playground/validator/v10
|
||||||
github.com/go-playground/validator/v10/translations/en
|
github.com/go-playground/validator/v10/translations/en
|
||||||
|
|||||||
Reference in New Issue
Block a user