// 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" ) // PayloadCommitVerification PayloadCommitVerification represents the GPG verification of a commit // // swagger:model PayloadCommitVerification type PayloadCommitVerification struct { // payload Payload string `json:"payload,omitempty"` // reason Reason string `json:"reason,omitempty"` // signature Signature string `json:"signature,omitempty"` // verified Verified bool `json:"verified,omitempty"` // signer Signer *PayloadUser `json:"signer,omitempty"` } // Validate validates this payload commit verification func (m *PayloadCommitVerification) Validate(formats strfmt.Registry) error { var res []error if err := m.validateSigner(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PayloadCommitVerification) validateSigner(formats strfmt.Registry) error { if swag.IsZero(m.Signer) { // not required return nil } if m.Signer != nil { if err := m.Signer.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("signer") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("signer") } return err } } return nil } // ContextValidate validate this payload commit verification based on the context it is used func (m *PayloadCommitVerification) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateSigner(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PayloadCommitVerification) contextValidateSigner(ctx context.Context, formats strfmt.Registry) error { if m.Signer != nil { if swag.IsZero(m.Signer) { // not required return nil } if err := m.Signer.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("signer") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("signer") } return err } } return nil } // MarshalBinary interface implementation func (m *PayloadCommitVerification) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PayloadCommitVerification) UnmarshalBinary(b []byte) error { var res PayloadCommitVerification if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }