github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/branches.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package mono_models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "context" 10 "strconv" 11 12 "github.com/go-openapi/errors" 13 "github.com/go-openapi/strfmt" 14 "github.com/go-openapi/swag" 15 ) 16 17 // Branches multiple branches 18 // 19 // swagger:model Branches 20 type Branches []*Branch 21 22 // Validate validates this branches 23 func (m Branches) Validate(formats strfmt.Registry) error { 24 var res []error 25 26 for i := 0; i < len(m); i++ { 27 if swag.IsZero(m[i]) { // not required 28 continue 29 } 30 31 if m[i] != nil { 32 if err := m[i].Validate(formats); err != nil { 33 if ve, ok := err.(*errors.Validation); ok { 34 return ve.ValidateName(strconv.Itoa(i)) 35 } 36 return err 37 } 38 } 39 40 } 41 42 if len(res) > 0 { 43 return errors.CompositeValidationError(res...) 44 } 45 return nil 46 } 47 48 // ContextValidate validate this branches based on the context it is used 49 func (m Branches) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 50 var res []error 51 52 for i := 0; i < len(m); i++ { 53 54 if m[i] != nil { 55 if err := m[i].ContextValidate(ctx, formats); err != nil { 56 if ve, ok := err.(*errors.Validation); ok { 57 return ve.ValidateName(strconv.Itoa(i)) 58 } 59 return err 60 } 61 } 62 63 } 64 65 if len(res) > 0 { 66 return errors.CompositeValidationError(res...) 67 } 68 return nil 69 }