95 lines
2.2 KiB
Go
95 lines
2.2 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"
|
||
|
)
|
||
|
|
||
|
// CommitDateOptions CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
|
||
|
//
|
||
|
// swagger:model CommitDateOptions
|
||
|
type CommitDateOptions struct {
|
||
|
|
||
|
// author
|
||
|
// Format: date-time
|
||
|
Author strfmt.DateTime `json:"author,omitempty"`
|
||
|
|
||
|
// committer
|
||
|
// Format: date-time
|
||
|
Committer strfmt.DateTime `json:"committer,omitempty"`
|
||
|
}
|
||
|
|
||
|
// Validate validates this commit date options
|
||
|
func (m *CommitDateOptions) Validate(formats strfmt.Registry) error {
|
||
|
var res []error
|
||
|
|
||
|
if err := m.validateAuthor(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateCommitter(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if len(res) > 0 {
|
||
|
return errors.CompositeValidationError(res...)
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *CommitDateOptions) validateAuthor(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Author) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := validate.FormatOf("author", "body", "date-time", m.Author.String(), formats); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *CommitDateOptions) validateCommitter(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Committer) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := validate.FormatOf("committer", "body", "date-time", m.Committer.String(), formats); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// ContextValidate validates this commit date options based on context it is used
|
||
|
func (m *CommitDateOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// MarshalBinary interface implementation
|
||
|
func (m *CommitDateOptions) MarshalBinary() ([]byte, error) {
|
||
|
if m == nil {
|
||
|
return nil, nil
|
||
|
}
|
||
|
return swag.WriteJSON(m)
|
||
|
}
|
||
|
|
||
|
// UnmarshalBinary interface implementation
|
||
|
func (m *CommitDateOptions) UnmarshalBinary(b []byte) error {
|
||
|
var res CommitDateOptions
|
||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
*m = res
|
||
|
return nil
|
||
|
}
|