// Validate returns an error if the transformations are not internally consistent.
512517
func (t BackendTransform) Validate() error {
	switch {
	case t.Adjust:
		if t.Zero {
			return fmt.Errorf("--adjust and --zero may not be specified together")
		}
		if t.Equal {
			return fmt.Errorf("--adjust and --equal may not be specified together")
		}
		if len(t.Inputs) != 1 {
			return fmt.Errorf("only one backend may be specified when adjusting")
		}

	case t.Zero, t.Equal:
		if t.Equal && t.Zero {
			return fmt.Errorf("--zero and --equal may not be specified together")
		}
		if len(t.Inputs) > 0 {
			return fmt.Errorf("arguments may not be provided when --zero or --equal is specified")
		}

	default:
		percent := false
		names := sets.NewString()
		for i, input := range t.Inputs {
			if names.Has(input.Name) {
				return fmt.Errorf("backend name %q may only be specified once", input.Name)
			}
			names.Insert(input.Name)
			if input.Percentage {
				if !percent && i != 0 {
					return fmt.Errorf("all backends must either be percentages or weights")
				}
				percent = true
			}
			if input.Value < 0 {
				return fmt.Errorf("negative percentages are not allowed")
			}
		}
	}
	return nil
}
351004
func (*BytesSchema) Validate(v reflect.Value) bool {
	v = dereference(v)

	return v.Kind() == reflect.Slice && v.Type().Elem().Kind() == reflect.Uint8
}
419344
func (m *Mark) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateRemains(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	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
}
1340426
func (l *Loop) Validate() error {
	if err := l.findValidationErrorNoIndex(); err != nil {
		return err
	}

	// Check for intersections between non-adjacent edges (including at vertices)
	// TODO(roberts): Once shapeutil gets findAnyCrossing uncomment this.
	// return findAnyCrossing(l.index)

	return nil
}
842589
func (m *FaultDelay) Validate() error {
	if m == nil {
		return nil
	}

	// no validation rules for Type

	{
		tmp := m.GetPercentage()

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

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

	switch m.FaultDelaySecifier.(type) {

	case *FaultDelay_FixedDelay:

		if d := m.GetFixedDelay(); d != nil {
			dur := *d

			gt := time.Duration(0*time.Second + 0*time.Nanosecond)

			if dur <= gt {
				return FaultDelayValidationError{
					field:  "FixedDelay",
					reason: "value must be greater than 0s",
				}
			}

		}

	case *FaultDelay_HeaderDelay_:

		{
			tmp := m.GetHeaderDelay()

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

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

	default:
		return FaultDelayValidationError{
			field:  "FaultDelaySecifier",
			reason: "value is required",
		}

	}

	return nil
}
360356
func (s *ArraySchema) Validate(v reflect.Value) bool {
	v = dereference(v)

	// This needs to be a slice
	return v.Kind() == reflect.Slice || v.Kind() == reflect.Array
}
402567
func (v Version) Validate() error {
	// Major, Minor, Patch already validated using uint64

	for _, pre := range v.Pre {
		if !pre.IsNum { //Numeric prerelease versions already uint64
			if len(pre.VersionStr) == 0 {
				return fmt.Errorf("Prerelease can not be empty %q", pre.VersionStr)
			}
			if !containsOnly(pre.VersionStr, alphanum) {
				return fmt.Errorf("Invalid character(s) found in prerelease %q", pre.VersionStr)
			}
		}
	}

	for _, build := range v.Build {
		if len(build) == 0 {
			return fmt.Errorf("Build meta data can not be empty %q", build)
		}
		if !containsOnly(build, alphanum) {
			return fmt.Errorf("Invalid character(s) found in build meta data %q", build)
		}
	}

	return nil
}
182811
func (val *Validation) Validate(checkers ...Checker) *Validation {

	for _, checker := range checkers {
		if pass, msg := checker(); !pass {
			if val == nil {
				val = &Validation{}
			}

			val.Errors = append(val.Errors, msg)
		}
	}

	return val
}
564021
func (p *Number) Validate() error {
	if p.Int8 != nil {
		p.Variant = NumberVariantInt8
	} else if p.Int16 != nil {
		p.Variant = NumberVariantInt16
	} else if p.Int32 != nil {
		p.Variant = NumberVariantInt32
	} else if p.Int64 != nil {
		p.Variant = NumberVariantInt64
	} else if p.Float32 != nil {
		p.Variant = NumberVariantFloat32
	} else if p.Float64 != nil {
		p.Variant = NumberVariantFloat64
	} else {
		return fmt.Errorf("Number: Missing required variant")
	}
	return nil
}
176890
func (t *Terraform) Validate() []error {
	var errs []error

	if raw := t.RequiredVersion; raw != "" {
		// Check that the value has no interpolations
		rc, err := NewRawConfig(map[string]interface{}{
			"root": raw,
		})
		if err != nil {
			errs = append(errs, fmt.Errorf(
				"terraform.required_version: %s", err))
		} else if len(rc.Interpolations) > 0 {
			errs = append(errs, fmt.Errorf(
				"terraform.required_version: cannot contain interpolations"))
		} else {
			// Check it is valid
			_, err := version.NewConstraint(raw)
			if err != nil {
				errs = append(errs, fmt.Errorf(
					"terraform.required_version: invalid syntax: %s", err))
			}
		}
	}

	if t.Backend != nil {
		errs = append(errs, t.Backend.Validate()...)
	}

	return errs
}
1164624
func (config Config) Validate() error {
	if config.Facade == nil {
		return errors.NotValidf("nil Facade")
	}
	if config.Entity == nil {
		return errors.NotValidf("nil Entity")
	}
	if config.Result == nil {
		return errors.NotValidf("nil Result")
	}
	return nil
}
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
}
535066
func (c *ChannelsJoinCall) Validate(validate bool) *ChannelsJoinCall {
	c.validate = validate
	return c
}
670203
func (*FloatSchema) Validate(v reflect.Value) bool {
	return reflect.TypeOf(dereference(v).Interface()).Kind() == reflect.Float32
}
140520
func (s *RecursiveSchema) Validate(v reflect.Value) bool {
	return s.Actual.Validate(v)
}
655759
func Validate(node ast.Node, inPrepare bool) error {
	v := validator{inPrepare: inPrepare}
	node.Accept(&v)
	return v.err
}