90 lines
1.5 KiB
Go
90 lines
1.5 KiB
Go
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 (
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
/*Dashboard dashboard
|
|
|
|
swagger:model Dashboard
|
|
*/
|
|
type Dashboard struct {
|
|
|
|
/* Cells are the individual visualization elements.
|
|
|
|
Required: true
|
|
*/
|
|
Cells []*Cell `json:"cells"`
|
|
|
|
/* link
|
|
*/
|
|
Link *Link `json:"link,omitempty"`
|
|
}
|
|
|
|
// Validate validates this dashboard
|
|
func (m *Dashboard) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateCells(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateLink(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Dashboard) validateCells(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("cells", "body", m.Cells); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.Cells); i++ {
|
|
|
|
if swag.IsZero(m.Cells[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Cells[i] != nil {
|
|
|
|
if err := m.Cells[i].Validate(formats); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Dashboard) validateLink(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.Link) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Link != nil {
|
|
|
|
if err := m.Link.Validate(formats); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|