125 lines
2.7 KiB
Go
125 lines
2.7 KiB
Go
|
// 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"
|
||
|
|
||
|
"github.com/go-openapi/errors"
|
||
|
"github.com/go-openapi/strfmt"
|
||
|
"github.com/go-openapi/swag"
|
||
|
"github.com/go-openapi/validate"
|
||
|
)
|
||
|
|
||
|
// TeamMembership team membership
|
||
|
//
|
||
|
// swagger:model TeamMembership
|
||
|
type TeamMembership struct {
|
||
|
|
||
|
// team
|
||
|
// Required: true
|
||
|
Team *Team `json:"team"`
|
||
|
|
||
|
// teamlead
|
||
|
// Required: true
|
||
|
Teamlead *bool `json:"teamlead"`
|
||
|
}
|
||
|
|
||
|
// Validate validates this team membership
|
||
|
func (m *TeamMembership) Validate(formats strfmt.Registry) error {
|
||
|
var res []error
|
||
|
|
||
|
if err := m.validateTeam(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateTeamlead(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if len(res) > 0 {
|
||
|
return errors.CompositeValidationError(res...)
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *TeamMembership) validateTeam(formats strfmt.Registry) error {
|
||
|
|
||
|
if err := validate.Required("team", "body", m.Team); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
if m.Team != nil {
|
||
|
if err := m.Team.Validate(formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("team")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("team")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *TeamMembership) validateTeamlead(formats strfmt.Registry) error {
|
||
|
|
||
|
if err := validate.Required("teamlead", "body", m.Teamlead); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// ContextValidate validate this team membership based on the context it is used
|
||
|
func (m *TeamMembership) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||
|
var res []error
|
||
|
|
||
|
if err := m.contextValidateTeam(ctx, formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if len(res) > 0 {
|
||
|
return errors.CompositeValidationError(res...)
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *TeamMembership) contextValidateTeam(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
||
|
if m.Team != nil {
|
||
|
if err := m.Team.ContextValidate(ctx, formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("team")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("team")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// MarshalBinary interface implementation
|
||
|
func (m *TeamMembership) MarshalBinary() ([]byte, error) {
|
||
|
if m == nil {
|
||
|
return nil, nil
|
||
|
}
|
||
|
return swag.WriteJSON(m)
|
||
|
}
|
||
|
|
||
|
// UnmarshalBinary interface implementation
|
||
|
func (m *TeamMembership) UnmarshalBinary(b []byte) error {
|
||
|
var res TeamMembership
|
||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
*m = res
|
||
|
return nil
|
||
|
}
|