762 lines
17 KiB
Go
762 lines
17 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"
|
||
|
"strconv"
|
||
|
|
||
|
"github.com/go-openapi/errors"
|
||
|
"github.com/go-openapi/strfmt"
|
||
|
"github.com/go-openapi/swag"
|
||
|
"github.com/go-openapi/validate"
|
||
|
)
|
||
|
|
||
|
// PullRequest PullRequest represents a pull request
|
||
|
//
|
||
|
// swagger:model PullRequest
|
||
|
type PullRequest struct {
|
||
|
|
||
|
// additions
|
||
|
Additions int64 `json:"additions,omitempty"`
|
||
|
|
||
|
// allow maintainer edit
|
||
|
AllowMaintainerEdit bool `json:"allow_maintainer_edit,omitempty"`
|
||
|
|
||
|
// assignees
|
||
|
Assignees []*User `json:"assignees"`
|
||
|
|
||
|
// body
|
||
|
Body string `json:"body,omitempty"`
|
||
|
|
||
|
// changed files
|
||
|
ChangedFiles int64 `json:"changed_files,omitempty"`
|
||
|
|
||
|
// closed
|
||
|
// Format: date-time
|
||
|
Closed strfmt.DateTime `json:"closed_at,omitempty"`
|
||
|
|
||
|
// comments
|
||
|
Comments int64 `json:"comments,omitempty"`
|
||
|
|
||
|
// created
|
||
|
// Format: date-time
|
||
|
Created strfmt.DateTime `json:"created_at,omitempty"`
|
||
|
|
||
|
// deadline
|
||
|
// Format: date-time
|
||
|
Deadline strfmt.DateTime `json:"due_date,omitempty"`
|
||
|
|
||
|
// deletions
|
||
|
Deletions int64 `json:"deletions,omitempty"`
|
||
|
|
||
|
// diff URL
|
||
|
DiffURL string `json:"diff_url,omitempty"`
|
||
|
|
||
|
// draft
|
||
|
Draft bool `json:"draft,omitempty"`
|
||
|
|
||
|
// HTML URL
|
||
|
HTMLURL string `json:"html_url,omitempty"`
|
||
|
|
||
|
// has merged
|
||
|
HasMerged bool `json:"merged,omitempty"`
|
||
|
|
||
|
// ID
|
||
|
ID int64 `json:"id,omitempty"`
|
||
|
|
||
|
// index
|
||
|
Index int64 `json:"number,omitempty"`
|
||
|
|
||
|
// is locked
|
||
|
IsLocked bool `json:"is_locked,omitempty"`
|
||
|
|
||
|
// labels
|
||
|
Labels []*Label `json:"labels"`
|
||
|
|
||
|
// merge base
|
||
|
MergeBase string `json:"merge_base,omitempty"`
|
||
|
|
||
|
// mergeable
|
||
|
Mergeable bool `json:"mergeable,omitempty"`
|
||
|
|
||
|
// merged
|
||
|
// Format: date-time
|
||
|
Merged strfmt.DateTime `json:"merged_at,omitempty"`
|
||
|
|
||
|
// merged commit ID
|
||
|
MergedCommitID string `json:"merge_commit_sha,omitempty"`
|
||
|
|
||
|
// patch URL
|
||
|
PatchURL string `json:"patch_url,omitempty"`
|
||
|
|
||
|
// pin order
|
||
|
PinOrder int64 `json:"pin_order,omitempty"`
|
||
|
|
||
|
// requested reviewers
|
||
|
RequestedReviewers []*User `json:"requested_reviewers"`
|
||
|
|
||
|
// number of review comments made on the diff of a PR review (not including comments on commits or issues in a PR)
|
||
|
ReviewComments int64 `json:"review_comments,omitempty"`
|
||
|
|
||
|
// title
|
||
|
Title string `json:"title,omitempty"`
|
||
|
|
||
|
// URL
|
||
|
URL string `json:"url,omitempty"`
|
||
|
|
||
|
// updated
|
||
|
// Format: date-time
|
||
|
Updated strfmt.DateTime `json:"updated_at,omitempty"`
|
||
|
|
||
|
// assignee
|
||
|
Assignee *User `json:"assignee,omitempty"`
|
||
|
|
||
|
// base
|
||
|
Base *PRBranchInfo `json:"base,omitempty"`
|
||
|
|
||
|
// head
|
||
|
Head *PRBranchInfo `json:"head,omitempty"`
|
||
|
|
||
|
// merged by
|
||
|
MergedBy *User `json:"merged_by,omitempty"`
|
||
|
|
||
|
// milestone
|
||
|
Milestone *Milestone `json:"milestone,omitempty"`
|
||
|
|
||
|
// state
|
||
|
State StateType `json:"state,omitempty"`
|
||
|
|
||
|
// user
|
||
|
User *User `json:"user,omitempty"`
|
||
|
}
|
||
|
|
||
|
// Validate validates this pull request
|
||
|
func (m *PullRequest) Validate(formats strfmt.Registry) error {
|
||
|
var res []error
|
||
|
|
||
|
if err := m.validateAssignees(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateClosed(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateCreated(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateDeadline(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateLabels(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateMerged(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateRequestedReviewers(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateUpdated(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateAssignee(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateBase(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateHead(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateMergedBy(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateMilestone(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateState(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.validateUser(formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if len(res) > 0 {
|
||
|
return errors.CompositeValidationError(res...)
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateAssignees(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Assignees) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
for i := 0; i < len(m.Assignees); i++ {
|
||
|
if swag.IsZero(m.Assignees[i]) { // not required
|
||
|
continue
|
||
|
}
|
||
|
|
||
|
if m.Assignees[i] != nil {
|
||
|
if err := m.Assignees[i].Validate(formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("assignees" + "." + strconv.Itoa(i))
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("assignees" + "." + strconv.Itoa(i))
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateClosed(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Closed) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := validate.FormatOf("closed_at", "body", "date-time", m.Closed.String(), formats); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateCreated(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Created) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := validate.FormatOf("created_at", "body", "date-time", m.Created.String(), formats); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateDeadline(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Deadline) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := validate.FormatOf("due_date", "body", "date-time", m.Deadline.String(), formats); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateLabels(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Labels) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
for i := 0; i < len(m.Labels); i++ {
|
||
|
if swag.IsZero(m.Labels[i]) { // not required
|
||
|
continue
|
||
|
}
|
||
|
|
||
|
if m.Labels[i] != nil {
|
||
|
if err := m.Labels[i].Validate(formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("labels" + "." + strconv.Itoa(i))
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("labels" + "." + strconv.Itoa(i))
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateMerged(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Merged) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := validate.FormatOf("merged_at", "body", "date-time", m.Merged.String(), formats); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateRequestedReviewers(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.RequestedReviewers) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
for i := 0; i < len(m.RequestedReviewers); i++ {
|
||
|
if swag.IsZero(m.RequestedReviewers[i]) { // not required
|
||
|
continue
|
||
|
}
|
||
|
|
||
|
if m.RequestedReviewers[i] != nil {
|
||
|
if err := m.RequestedReviewers[i].Validate(formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("requested_reviewers" + "." + strconv.Itoa(i))
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("requested_reviewers" + "." + strconv.Itoa(i))
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateUpdated(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Updated) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := validate.FormatOf("updated_at", "body", "date-time", m.Updated.String(), formats); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateAssignee(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Assignee) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if m.Assignee != nil {
|
||
|
if err := m.Assignee.Validate(formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("assignee")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("assignee")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateBase(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Base) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if m.Base != nil {
|
||
|
if err := m.Base.Validate(formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("base")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("base")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateHead(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Head) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if m.Head != nil {
|
||
|
if err := m.Head.Validate(formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("head")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("head")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateMergedBy(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.MergedBy) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if m.MergedBy != nil {
|
||
|
if err := m.MergedBy.Validate(formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("merged_by")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("merged_by")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateMilestone(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.Milestone) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if m.Milestone != nil {
|
||
|
if err := m.Milestone.Validate(formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("milestone")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("milestone")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateState(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.State) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := m.State.Validate(formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("state")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("state")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) validateUser(formats strfmt.Registry) error {
|
||
|
if swag.IsZero(m.User) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if m.User != nil {
|
||
|
if err := m.User.Validate(formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("user")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("user")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// ContextValidate validate this pull request based on the context it is used
|
||
|
func (m *PullRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||
|
var res []error
|
||
|
|
||
|
if err := m.contextValidateAssignees(ctx, formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.contextValidateLabels(ctx, formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.contextValidateRequestedReviewers(ctx, formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.contextValidateAssignee(ctx, formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.contextValidateBase(ctx, formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.contextValidateHead(ctx, formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.contextValidateMergedBy(ctx, formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.contextValidateMilestone(ctx, formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.contextValidateState(ctx, formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if err := m.contextValidateUser(ctx, formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if len(res) > 0 {
|
||
|
return errors.CompositeValidationError(res...)
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) contextValidateAssignees(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
||
|
for i := 0; i < len(m.Assignees); i++ {
|
||
|
|
||
|
if m.Assignees[i] != nil {
|
||
|
|
||
|
if swag.IsZero(m.Assignees[i]) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := m.Assignees[i].ContextValidate(ctx, formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("assignees" + "." + strconv.Itoa(i))
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("assignees" + "." + strconv.Itoa(i))
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
||
|
for i := 0; i < len(m.Labels); i++ {
|
||
|
|
||
|
if m.Labels[i] != nil {
|
||
|
|
||
|
if swag.IsZero(m.Labels[i]) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := m.Labels[i].ContextValidate(ctx, formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("labels" + "." + strconv.Itoa(i))
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("labels" + "." + strconv.Itoa(i))
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) contextValidateRequestedReviewers(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
||
|
for i := 0; i < len(m.RequestedReviewers); i++ {
|
||
|
|
||
|
if m.RequestedReviewers[i] != nil {
|
||
|
|
||
|
if swag.IsZero(m.RequestedReviewers[i]) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := m.RequestedReviewers[i].ContextValidate(ctx, formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("requested_reviewers" + "." + strconv.Itoa(i))
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("requested_reviewers" + "." + strconv.Itoa(i))
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) contextValidateAssignee(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
||
|
if m.Assignee != nil {
|
||
|
|
||
|
if swag.IsZero(m.Assignee) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := m.Assignee.ContextValidate(ctx, formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("assignee")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("assignee")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) contextValidateBase(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
||
|
if m.Base != nil {
|
||
|
|
||
|
if swag.IsZero(m.Base) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := m.Base.ContextValidate(ctx, formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("base")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("base")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) contextValidateHead(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
||
|
if m.Head != nil {
|
||
|
|
||
|
if swag.IsZero(m.Head) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := m.Head.ContextValidate(ctx, formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("head")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("head")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) contextValidateMergedBy(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
||
|
if m.MergedBy != nil {
|
||
|
|
||
|
if swag.IsZero(m.MergedBy) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := m.MergedBy.ContextValidate(ctx, formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("merged_by")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("merged_by")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) contextValidateMilestone(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
||
|
if m.Milestone != nil {
|
||
|
|
||
|
if swag.IsZero(m.Milestone) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := m.Milestone.ContextValidate(ctx, formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("milestone")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("milestone")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) contextValidateState(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
||
|
if swag.IsZero(m.State) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := m.State.ContextValidate(ctx, formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("state")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("state")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (m *PullRequest) contextValidateUser(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
||
|
if m.User != nil {
|
||
|
|
||
|
if swag.IsZero(m.User) { // not required
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := m.User.ContextValidate(ctx, formats); err != nil {
|
||
|
if ve, ok := err.(*errors.Validation); ok {
|
||
|
return ve.ValidateName("user")
|
||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||
|
return ce.ValidateName("user")
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// MarshalBinary interface implementation
|
||
|
func (m *PullRequest) MarshalBinary() ([]byte, error) {
|
||
|
if m == nil {
|
||
|
return nil, nil
|
||
|
}
|
||
|
return swag.WriteJSON(m)
|
||
|
}
|
||
|
|
||
|
// UnmarshalBinary interface implementation
|
||
|
func (m *PullRequest) UnmarshalBinary(b []byte) error {
|
||
|
var res PullRequest
|
||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
*m = res
|
||
|
return nil
|
||
|
}
|