src.dualinventive.com/go/assets-service/rest/models/assets_list.go

84 lines
1.6 KiB
Go

// 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 (
"strconv"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
)
// AssetsList assets list
// swagger:model AssetsList
type AssetsList struct {
// asset
Asset []*Asset `json:"asset"`
// count
Count int64 `json:"count,omitempty"`
}
// Validate validates this assets list
func (m *AssetsList) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAsset(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *AssetsList) validateAsset(formats strfmt.Registry) error {
if swag.IsZero(m.Asset) { // not required
return nil
}
for i := 0; i < len(m.Asset); i++ {
if swag.IsZero(m.Asset[i]) { // not required
continue
}
if m.Asset[i] != nil {
if err := m.Asset[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("asset" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *AssetsList) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AssetsList) UnmarshalBinary(b []byte) error {
var res AssetsList
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}