// 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" ) // WikiCommit WikiCommit page commit/revision // // swagger:model WikiCommit type WikiCommit struct { // ID ID string `json:"sha,omitempty"` // message Message string `json:"message,omitempty"` // author Author *CommitUser `json:"author,omitempty"` // commiter Commiter *CommitUser `json:"commiter,omitempty"` } // Validate validates this wiki commit func (m *WikiCommit) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAuthor(formats); err != nil { res = append(res, err) } if err := m.validateCommiter(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *WikiCommit) validateAuthor(formats strfmt.Registry) error { if swag.IsZero(m.Author) { // not required return nil } if m.Author != nil { if err := m.Author.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("author") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("author") } return err } } return nil } func (m *WikiCommit) validateCommiter(formats strfmt.Registry) error { if swag.IsZero(m.Commiter) { // not required return nil } if m.Commiter != nil { if err := m.Commiter.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("commiter") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("commiter") } return err } } return nil } // ContextValidate validate this wiki commit based on the context it is used func (m *WikiCommit) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateAuthor(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateCommiter(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *WikiCommit) contextValidateAuthor(ctx context.Context, formats strfmt.Registry) error { if m.Author != nil { if swag.IsZero(m.Author) { // not required return nil } if err := m.Author.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("author") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("author") } return err } } return nil } func (m *WikiCommit) contextValidateCommiter(ctx context.Context, formats strfmt.Registry) error { if m.Commiter != nil { if swag.IsZero(m.Commiter) { // not required return nil } if err := m.Commiter.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("commiter") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("commiter") } return err } } return nil } // MarshalBinary interface implementation func (m *WikiCommit) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *WikiCommit) UnmarshalBinary(b []byte) error { var res WikiCommit if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }