// 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/direktiv/apps/go/pkg/apps" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PostParamsBodySheetsItems post params body sheets items // // swagger:model postParamsBodySheetsItems type PostParamsBodySheetsItems struct { // Name of the json input file to utilise Infile string `json:"infile,omitempty"` // File to create before running commands InputFile []apps.DirektivFile `json:"input-file"` // Label for the worksheet created in the spreadsheet Name *string `json:"name,omitempty"` } // Validate validates this post params body sheets items func (m *PostParamsBodySheetsItems) Validate(formats strfmt.Registry) error { var res []error if err := m.validateInputFile(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PostParamsBodySheetsItems) validateInputFile(formats strfmt.Registry) error { if swag.IsZero(m.InputFile) { // not required return nil } for i := 0; i < len(m.InputFile); i++ { if err := m.InputFile[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("input-file" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("input-file" + "." + strconv.Itoa(i)) } return err } } return nil } // ContextValidate validate this post params body sheets items based on the context it is used func (m *PostParamsBodySheetsItems) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateInputFile(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PostParamsBodySheetsItems) contextValidateInputFile(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.InputFile); i++ { if err := m.InputFile[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("input-file" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("input-file" + "." + strconv.Itoa(i)) } return err } } return nil } // MarshalBinary interface implementation func (m *PostParamsBodySheetsItems) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PostParamsBodySheetsItems) UnmarshalBinary(b []byte) error { var res PostParamsBodySheetsItems if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }