github.com/djarvur/go-swagger@v0.18.0/examples/tutorials/todo-list/server-complete/models/find_todos_okbody.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 ) 16 17 // FindTodosOKBody find todos o k body 18 // swagger:model findTodosOKBody 19 type FindTodosOKBody []*Item 20 21 // Validate validates this find todos o k body 22 func (m FindTodosOKBody) Validate(formats strfmt.Registry) error { 23 var res []error 24 25 for i := 0; i < len(m); i++ { 26 27 if swag.IsZero(m[i]) { // not required 28 continue 29 } 30 31 if m[i] != nil { 32 33 if err := m[i].Validate(formats); err != nil { 34 if ve, ok := err.(*errors.Validation); ok { 35 return ve.ValidateName(strconv.Itoa(i)) 36 } 37 return err 38 } 39 } 40 41 } 42 43 if len(res) > 0 { 44 return errors.CompositeValidationError(res...) 45 } 46 return nil 47 }