diff options
Diffstat (limited to 'vendor/github.com/go-openapi/validate/validator.go')
-rw-r--r-- | vendor/github.com/go-openapi/validate/validator.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/vendor/github.com/go-openapi/validate/validator.go b/vendor/github.com/go-openapi/validate/validator.go index df700d3cd4..2acb839db8 100644 --- a/vendor/github.com/go-openapi/validate/validator.go +++ b/vendor/github.com/go-openapi/validate/validator.go @@ -452,6 +452,7 @@ func (s *basicSliceValidator) Validate(data interface{}) *Result { return nil } +/* unused func (s *basicSliceValidator) hasDuplicates(value reflect.Value, size int) bool { dict := make(map[interface{}]struct{}) for i := 0; i < size; i++ { @@ -463,6 +464,7 @@ func (s *basicSliceValidator) hasDuplicates(value reflect.Value, size int) bool } return false } +*/ type numberValidator struct { Path string @@ -530,6 +532,7 @@ func (n *numberValidator) Validate(val interface{}) *Result { // Is the provided value within the range of the specified numeric type and format? res.AddErrors(IsValueValidAgainstRange(val, n.Type, n.Format, "Checked", n.Path)) + // nolint: dupl if n.MultipleOf != nil { // Is the constraint specifier within the range of the specific numeric type and format? resMultiple.AddErrors(IsValueValidAgainstRange(*n.MultipleOf, n.Type, n.Format, "MultipleOf", n.Path)) @@ -546,6 +549,7 @@ func (n *numberValidator) Validate(val interface{}) *Result { } } + // nolint: dupl if n.Maximum != nil { // Is the constraint specifier within the range of the specific numeric type and format? resMaximum.AddErrors(IsValueValidAgainstRange(*n.Maximum, n.Type, n.Format, "Maximum boundary", n.Path)) @@ -562,6 +566,7 @@ func (n *numberValidator) Validate(val interface{}) *Result { } } + // nolint: dupl if n.Minimum != nil { // Is the constraint specifier within the range of the specific numeric type and format? resMinimum.AddErrors(IsValueValidAgainstRange(*n.Minimum, n.Type, n.Format, "Minimum boundary", n.Path)) @@ -611,7 +616,7 @@ func (s *stringValidator) Applies(source interface{}, kind reflect.Kind) bool { func (s *stringValidator) Validate(val interface{}) *Result { data, ok := val.(string) if !ok { - return errorHelp.sErr(errors.InvalidType(s.Path, s.In, "string", val)) + return errorHelp.sErr(errors.InvalidType(s.Path, s.In, stringType, val)) } if s.Required && !s.AllowEmptyValue && (s.Default == nil || s.Default == "") { |