// Code generated by go-swagger; DO NOT EDIT. package models // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "context" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // TeamEditForm team edit form // // swagger:model TeamEditForm type TeamEditForm struct { // The hexadecimal color code (default: #d2d6de) Color string `json:"color,omitempty"` // All team members // Required: true Members []*TeamEditFormMembersItems0 `json:"members"` // Name of the team // Required: true Name *string `json:"name"` } // Validate validates this team edit form func (m *TeamEditForm) Validate(formats strfmt.Registry) error { var res []error if err := m.validateMembers(formats); err != nil { res = append(res, err) } if err := m.validateName(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *TeamEditForm) validateMembers(formats strfmt.Registry) error { if err := validate.Required("members", "body", m.Members); err != nil { return err } for i := 0; i < len(m.Members); i++ { if swag.IsZero(m.Members[i]) { // not required continue } if m.Members[i] != nil { if err := m.Members[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("members" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("members" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *TeamEditForm) validateName(formats strfmt.Registry) error { if err := validate.Required("name", "body", m.Name); err != nil { return err } return nil } // ContextValidate validate this team edit form based on the context it is used func (m *TeamEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateMembers(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *TeamEditForm) contextValidateMembers(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Members); i++ { if m.Members[i] != nil { if err := m.Members[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("members" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("members" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *TeamEditForm) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *TeamEditForm) UnmarshalBinary(b []byte) error { var res TeamEditForm if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // TeamEditFormMembersItems0 team edit form members items0 // // swagger:model TeamEditFormMembersItems0 type TeamEditFormMembersItems0 struct { // Whether the user is a teamlead Teamlead bool `json:"teamlead,omitempty"` // User ID User int64 `json:"user,omitempty"` } // Validate validates this team edit form members items0 func (m *TeamEditFormMembersItems0) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this team edit form members items0 based on context it is used func (m *TeamEditFormMembersItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *TeamEditFormMembersItems0) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *TeamEditFormMembersItems0) UnmarshalBinary(b []byte) error { var res TeamEditFormMembersItems0 if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }