63 lines
1.3 KiB
Go
63 lines
1.3 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/errors"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// Mapping mapping
|
|
// swagger:model Mapping
|
|
type Mapping struct {
|
|
|
|
// The measurement where data for this mapping is found
|
|
// Required: true
|
|
Measurement *string `json:"measurement"`
|
|
|
|
// The application name which will be assigned to the corresponding measurement
|
|
// Required: true
|
|
Name *string `json:"name"`
|
|
}
|
|
|
|
// Validate validates this mapping
|
|
func (m *Mapping) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateMeasurement(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateName(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Mapping) validateMeasurement(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("measurement", "body", m.Measurement); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Mapping) validateName(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("name", "body", m.Name); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|