github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/fixtures/bugs/1719/pkg/models/users_array_flat.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 // ExtUsersArrayFlat users array flat 18 // swagger:model ExtUsersArrayFlat 19 type ExtUsersArrayFlat []*ExtUsersArrayFlatItems0 20 21 // Validate validates this users array flat 22 func (m ExtUsersArrayFlat) Validate(formats strfmt.Registry) error { 23 var res []error 24 25 for i := 0; i < len(m); i++ { 26 if swag.IsZero(m[i]) { // not required 27 continue 28 } 29 30 if m[i] != nil { 31 if err := m[i].Validate(formats); err != nil { 32 if ve, ok := err.(*errors.Validation); ok { 33 return ve.ValidateName(strconv.Itoa(i)) 34 } 35 return err 36 } 37 } 38 39 } 40 41 if len(res) > 0 { 42 return errors.CompositeValidationError(res...) 43 } 44 return nil 45 } 46 47 // ExtUsersArrayFlatItems0 users array flat items0 48 // swagger:model ExtUsersArrayFlatItems0 49 type ExtUsersArrayFlatItems0 struct { 50 51 // age 52 Age int64 `json:"age,omitempty"` 53 54 // name 55 Name string `json:"name,omitempty"` 56 } 57 58 // Validate validates this users array flat items0 59 func (m *ExtUsersArrayFlatItems0) Validate(formats strfmt.Registry) error { 60 return nil 61 } 62 63 // MarshalBinary interface implementation 64 func (m *ExtUsersArrayFlatItems0) MarshalBinary() ([]byte, error) { 65 if m == nil { 66 return nil, nil 67 } 68 return swag.WriteJSON(m) 69 } 70 71 // UnmarshalBinary interface implementation 72 func (m *ExtUsersArrayFlatItems0) UnmarshalBinary(b []byte) error { 73 var res ExtUsersArrayFlatItems0 74 if err := swag.ReadJSON(b, &res); err != nil { 75 return err 76 } 77 *m = res 78 return nil 79 }