// Validate inspects the fields of the type to determine if they are valid.
Validate inspects the fields of the type to determine if they are valid.
// Validate inspects the fields of the type to determine if they are valid .
func (s *ParameterRanges) Validate() error {
	invalidParams := request.ErrInvalidParams{Context: "ParameterRanges"}
	if s.CategoricalParameterRanges != nil && len(s.CategoricalParameterRanges) < 1 {
		invalidParams.Add(request.NewErrParamMinLen("CategoricalParameterRanges", 1))
	}
	if s.ContinuousParameterRanges != nil && len(s.ContinuousParameterRanges) < 1 {
		invalidParams.Add(request.NewErrParamMinLen("ContinuousParameterRanges", 1))
	}
	if s.IntegerParameterRanges != nil && len(s.IntegerParameterRanges) < 1 {
		invalidParams.Add(request.NewErrParamMinLen("IntegerParameterRanges", 1))
	}
	if s.CategoricalParameterRanges != nil {
		for i, v := range s.CategoricalParameterRanges {
			if v == nil {
				continue
			}
			if err := v.Validate(); err != nil {
				invalidParams.AddNested(fmt.Sprintf("%s[%v]", "CategoricalParameterRanges", i), err.(request.ErrInvalidParams))
			}
		}
	}
	if s.ContinuousParameterRanges != nil {
		for i, v := range s.ContinuousParameterRanges {
			if v == nil {
				continue
			}
			if err := v.Validate(); err != nil {
				invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ContinuousParameterRanges", i), err.(request.ErrInvalidParams))
			}
		}
	}
	if s.IntegerParameterRanges != nil {
		for i, v := range s.IntegerParameterRanges {
			if v == nil {
				continue
			}
			if err := v.Validate(); err != nil {
				invalidParams.AddNested(fmt.Sprintf("%s[%v]", "IntegerParameterRanges", i), err.(request.ErrInvalidParams))
			}
		}
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	}
	return nil
}
func ( s * ParameterRanges ) Validate ( ) error { invalidParams := request . ErrInvalidParams { Context : " " } if s . CategoricalParameterRanges != nil && len ( s . CategoricalParameterRanges ) < 1 { invalidParams . Add ( request . NewErrParamMinLen ( " " , 1 ) ) } if s . ContinuousParameterRanges != nil && len ( s . ContinuousParameterRanges ) < 1 { invalidParams . Add ( request . NewErrParamMinLen ( " " , 1 ) ) } if s . IntegerParameterRanges != nil && len ( s . IntegerParameterRanges ) < 1 { invalidParams . Add ( request . NewErrParamMinLen ( " " , 1 ) ) } if s . CategoricalParameterRanges != nil { for i , v := range s . CategoricalParameterRanges { if v == nil { continue } if err := v . Validate ( ) ; err != nil { invalidParams . AddNested ( fmt . Sprintf ( " " , " " , i ) , err . ( request . ErrInvalidParams ) ) } } } if s . ContinuousParameterRanges != nil { for i , v := range s . ContinuousParameterRanges { if v == nil { continue } if err := v . Validate ( ) ; err != nil { invalidParams . AddNested ( fmt . Sprintf ( " " , " " , i ) , err . ( request . ErrInvalidParams ) ) } } } if s . IntegerParameterRanges != nil { for i , v := range s . IntegerParameterRanges { if v == nil { continue } if err := v . Validate ( ) ; err != nil { invalidParams . AddNested ( fmt . Sprintf ( " " , " " , i ) , err . ( request . ErrInvalidParams ) ) } } } if invalidParams . Len ( ) > 0 { return invalidParams } return nil }
Validate inspects the fields of the type to determine if they are valid.
Validate inspects the fields of the type to determine if they are valid .