func (b *basicCommonValidator) Validate(data interface{}) (res *Result) { if len(b.Enum) > 0 { for _, enumValue := range b.Enum { if data != nil && reflect.DeepEqual(enumValue, data) { return nil } } return sErr(errors.EnumFail(b.Path, b.In, data, b.Enum)) } return nil }
func enumFail(param *spec.Parameter, data interface{}) *errors.Validation { return errors.EnumFail(param.Name, param.In, data, param.Enum) }
func enumFailItems(path, in string, items *spec.Items, data interface{}) *errors.Validation { return errors.EnumFail(path, in, data, items.Enum) }