github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/models/dry_run_input.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "strconv" 10 11 strfmt "github.com/go-openapi/strfmt" 12 13 "github.com/go-openapi/errors" 14 "github.com/go-openapi/swag" 15 "github.com/go-openapi/validate" 16 ) 17 18 // DryRunInput dry run input 19 // swagger:model DryRunInput 20 type DryRunInput struct { 21 22 // Accounts 23 Accounts []*DryRunAccount `json:"accounts"` 24 25 // top 26 Top EncodedHash `json:"top,omitempty"` 27 28 // Txs 29 // Required: true 30 Txs []EncodedByteArray `json:"txs"` 31 } 32 33 // Validate validates this dry run input 34 func (m *DryRunInput) Validate(formats strfmt.Registry) error { 35 var res []error 36 37 if err := m.validateAccounts(formats); err != nil { 38 res = append(res, err) 39 } 40 41 if err := m.validateTop(formats); err != nil { 42 res = append(res, err) 43 } 44 45 if err := m.validateTxs(formats); err != nil { 46 res = append(res, err) 47 } 48 49 if len(res) > 0 { 50 return errors.CompositeValidationError(res...) 51 } 52 return nil 53 } 54 55 func (m *DryRunInput) validateAccounts(formats strfmt.Registry) error { 56 57 if swag.IsZero(m.Accounts) { // not required 58 return nil 59 } 60 61 for i := 0; i < len(m.Accounts); i++ { 62 if swag.IsZero(m.Accounts[i]) { // not required 63 continue 64 } 65 66 if m.Accounts[i] != nil { 67 if err := m.Accounts[i].Validate(formats); err != nil { 68 if ve, ok := err.(*errors.Validation); ok { 69 return ve.ValidateName("accounts" + "." + strconv.Itoa(i)) 70 } 71 return err 72 } 73 } 74 75 } 76 77 return nil 78 } 79 80 func (m *DryRunInput) validateTop(formats strfmt.Registry) error { 81 82 if swag.IsZero(m.Top) { // not required 83 return nil 84 } 85 86 if err := m.Top.Validate(formats); err != nil { 87 if ve, ok := err.(*errors.Validation); ok { 88 return ve.ValidateName("top") 89 } 90 return err 91 } 92 93 return nil 94 } 95 96 func (m *DryRunInput) validateTxs(formats strfmt.Registry) error { 97 98 if err := validate.Required("txs", "body", m.Txs); err != nil { 99 return err 100 } 101 102 for i := 0; i < len(m.Txs); i++ { 103 104 if err := m.Txs[i].Validate(formats); err != nil { 105 if ve, ok := err.(*errors.Validation); ok { 106 return ve.ValidateName("txs" + "." + strconv.Itoa(i)) 107 } 108 return err 109 } 110 111 } 112 113 return nil 114 } 115 116 // MarshalBinary interface implementation 117 func (m *DryRunInput) MarshalBinary() ([]byte, error) { 118 if m == nil { 119 return nil, nil 120 } 121 return swag.WriteJSON(m) 122 } 123 124 // UnmarshalBinary interface implementation 125 func (m *DryRunInput) UnmarshalBinary(b []byte) error { 126 var res DryRunInput 127 if err := swag.ReadJSON(b, &res); err != nil { 128 return err 129 } 130 *m = res 131 return nil 132 }