// Validate checks the field values on FilterStateRule with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
426190
func (m *FilterStateRule) Validate() error {
	if m == nil {
		return nil
	}

	if len(m.GetName()) < 1 {
		return FilterStateRuleValidationError{
			field:  "Name",
			reason: "value length must be at least 1 bytes",
		}
	}

	// no validation rules for Requires

	return nil
}
136367
func (filter *Filter) Validate() error {
	if filter.EventFormat != "client" && filter.EventFormat != "federation" {
		return errors.New("Bad event_format value. Must be one of [\"client\", \"federation\"]")
	}
	return nil
}
1271945
func (m *SocketOption) Validate() error {
	if m == nil {
		return nil
	}

	// no validation rules for Description

	// no validation rules for Level

	// no validation rules for Name

	if _, ok := SocketOption_SocketState_name[int32(m.GetState())]; !ok {
		return SocketOptionValidationError{
			field:  "State",
			reason: "value must be one of the defined enum values",
		}
	}

	switch m.Value.(type) {

	case *SocketOption_IntValue:
		// no validation rules for IntValue

	case *SocketOption_BufValue:
		// no validation rules for BufValue

	default:
		return SocketOptionValidationError{
			field:  "Value",
			reason: "value is required",
		}

	}

	return nil
}
218706
func (r *ResponseDefinition) Validate() *dslengine.ValidationErrors {
	verr := new(dslengine.ValidationErrors)
	if r.Headers != nil {
		verr.Merge(r.Headers.Validate("response headers", r))
	}
	if r.Status == 0 {
		verr.Add(r, "response status not defined")
	}
	return verr.AsError()
}
945338
func (p *Type) Validate() error {
	if p.BaseType != nil {
		p.Variant = TypeVariantBaseType
	} else if p.StructTypeDef != nil {
		p.Variant = TypeVariantStructTypeDef
	} else if p.MapTypeDef != nil {
		p.Variant = TypeVariantMapTypeDef
	} else if p.ArrayTypeDef != nil {
		p.Variant = TypeVariantArrayTypeDef
	} else if p.EnumTypeDef != nil {
		p.Variant = TypeVariantEnumTypeDef
	} else if p.UnionTypeDef != nil {
		p.Variant = TypeVariantUnionTypeDef
	} else if p.StringTypeDef != nil {
		p.Variant = TypeVariantStringTypeDef
	} else if p.BytesTypeDef != nil {
		p.Variant = TypeVariantBytesTypeDef
	} else if p.NumberTypeDef != nil {
		p.Variant = TypeVariantNumberTypeDef
	} else if p.AliasTypeDef != nil {
		p.Variant = TypeVariantAliasTypeDef
	} else {
		return fmt.Errorf("Type: Missing required variant")
	}
	return nil
}
20334
func (v *requiredRule) Validate(value interface{}) error {
	value, isNil := Indirect(value)
	if v.skipNil && !isNil && IsEmpty(value) || !v.skipNil && (isNil || IsEmpty(value)) {
		return errors.New(v.message)
	}
	return nil
}
760278
func (m *JwtAuthentication) Validate() error {
	if m == nil {
		return nil
	}

	// no validation rules for Providers

	for idx, item := range m.GetRules() {
		_, _ = idx, item

		{
			tmp := item

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return JwtAuthenticationValidationError{
						field:  fmt.Sprintf("Rules[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	}

	{
		tmp := m.GetFilterStateRules()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return JwtAuthenticationValidationError{
					field:  "FilterStateRules",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	return nil
}
1335299
func (m *CsrfPolicy) Validate() error {
	if m == nil {
		return nil
	}

	if m.GetFilterEnabled() == nil {
		return CsrfPolicyValidationError{
			field:  "FilterEnabled",
			reason: "value is required",
		}
	}

	{
		tmp := m.GetFilterEnabled()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return CsrfPolicyValidationError{
					field:  "FilterEnabled",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	{
		tmp := m.GetShadowEnabled()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return CsrfPolicyValidationError{
					field:  "ShadowEnabled",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	return nil
}
1355651
func (*DoubleSchema) Validate(v reflect.Value) bool {
	return reflect.TypeOf(dereference(v).Interface()).Kind() == reflect.Float64
}
140520
func (s *RecursiveSchema) Validate(v reflect.Value) bool {
	return s.Actual.Validate(v)
}
45658
func (s *StringRule) Validate(cv ctypes.ConfigValue) error {
	// Check that type is correct
	if cv.Type() != StringType {
		return wrongType(s.key, cv.Type(), StringType)
	}
	return nil
}
759329
func (*NullSchema) Validate(v reflect.Value) bool {
	// Check if the value is something that can be null
	switch v.Kind() {
	case reflect.Interface:
		return v.IsNil()
	case reflect.Array:
		return v.Cap() == 0
	case reflect.Slice:
		return v.IsNil() || v.Cap() == 0
	case reflect.Map:
		return len(v.MapKeys()) == 0
	case reflect.String:
		return len(v.String()) == 0
	case reflect.Float32:
		// Should NaN floats be treated as null?
		return math.IsNaN(v.Float())
	case reflect.Float64:
		// Should NaN floats be treated as null?
		return math.IsNaN(v.Float())
	case reflect.Ptr:
		return v.IsNil()
	case reflect.Invalid:
		return true
	}

	// Nothing else in particular, so this should not validate?
	return false
}
404738
func (m *HeaderFilter) Validate() error {
	if m == nil {
		return nil
	}

	if m.GetHeader() == nil {
		return HeaderFilterValidationError{
			field:  "Header",
			reason: "value is required",
		}
	}

	{
		tmp := m.GetHeader()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return HeaderFilterValidationError{
					field:  "Header",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	return nil
}
1043783
func (v *StringRule) Validate(value interface{}) error {
	value, isNil := Indirect(value)
	if isNil || IsEmpty(value) {
		return nil
	}

	str, err := EnsureString(value)
	if err != nil {
		return err
	}

	if v.validate(str) {
		return nil
	}
	return errors.New(v.message)
}
861305
func (m *Filter) Validate() error {
	if m == nil {
		return nil
	}

	if len(m.GetName()) < 1 {
		return FilterValidationError{
			field:  "Name",
			reason: "value length must be at least 1 bytes",
		}
	}

	switch m.ConfigType.(type) {

	case *Filter_Config:

		{
			tmp := m.GetConfig()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return FilterValidationError{
						field:  "Config",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *Filter_TypedConfig:

		{
			tmp := m.GetTypedConfig()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return FilterValidationError{
						field:  "TypedConfig",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	}

	return nil
}
517074
func (args Args) Validate(accepted map[string]bool) error {
	for name := range args.fields {
		if !accepted[name] {
			return invalidFilter(name)
		}
	}
	return nil
}
821647
func (st *State) validate(cfg, old *config.Config) (valid *config.Config, err error) {
	if st.policy == nil {
		return cfg, nil
	}
	configValidator, err := st.policy.ConfigValidator()
	if errors.IsNotImplemented(err) {
		return cfg, nil
	} else if err != nil {
		return nil, err
	}
	if configValidator == nil {
		return nil, errors.New("policy returned nil configValidator without an error")
	}
	return configValidator.Validate(cfg, old)
}