(all bool)
| 153 | } |
| 154 | |
| 155 | func (m *GetUserReply) validate(all bool) error { |
| 156 | if m == nil { |
| 157 | return nil |
| 158 | } |
| 159 | |
| 160 | var errors []error |
| 161 | |
| 162 | if all { |
| 163 | switch v := interface{}(m.GetItem()).(type) { |
| 164 | case interface{ ValidateAll() error }: |
| 165 | if err := v.ValidateAll(); err != nil { |
| 166 | errors = append(errors, GetUserReplyValidationError{ |
| 167 | field: "Item", |
| 168 | reason: "embedded message failed validation", |
| 169 | cause: err, |
| 170 | }) |
| 171 | } |
| 172 | case interface{ Validate() error }: |
| 173 | if err := v.Validate(); err != nil { |
| 174 | errors = append(errors, GetUserReplyValidationError{ |
| 175 | field: "Item", |
| 176 | reason: "embedded message failed validation", |
| 177 | cause: err, |
| 178 | }) |
| 179 | } |
| 180 | } |
| 181 | } else if v, ok := interface{}(m.GetItem()).(interface{ Validate() error }); ok { |
| 182 | if err := v.Validate(); err != nil { |
| 183 | return GetUserReplyValidationError{ |
| 184 | field: "Item", |
| 185 | reason: "embedded message failed validation", |
| 186 | cause: err, |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | if len(errors) > 0 { |
| 192 | return GetUserReplyMultiError(errors) |
| 193 | } |
| 194 | |
| 195 | return nil |
| 196 | } |
| 197 | |
| 198 | // GetUserReplyMultiError is an error wrapping multiple validation errors |
| 199 | // returned by GetUserReply.ValidateAll() if the designated constraints aren't met. |
no test coverage detected