Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
109
pkg/ota_api/models/handlers_json_car_state_message.go
Normal file
109
pkg/ota_api/models/handlers_json_car_state_message.go
Normal file
@@ -0,0 +1,109 @@
|
||||
// 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 (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// HandlersJSONCarStateMessage handlers JSON car state message
|
||||
//
|
||||
// swagger:model handlers.JSONCarStateMessage
|
||||
type HandlersJSONCarStateMessage struct {
|
||||
|
||||
// data
|
||||
Data *CommonCarState `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this handlers JSON car state message
|
||||
func (m *HandlersJSONCarStateMessage) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateData(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HandlersJSONCarStateMessage) validateData(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Data) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.Data != nil {
|
||||
if err := m.Data.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("data")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("data")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this handlers JSON car state message based on the context it is used
|
||||
func (m *HandlersJSONCarStateMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateData(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HandlersJSONCarStateMessage) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Data != nil {
|
||||
|
||||
if swag.IsZero(m.Data) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Data.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("data")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("data")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *HandlersJSONCarStateMessage) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *HandlersJSONCarStateMessage) UnmarshalBinary(b []byte) error {
|
||||
var res HandlersJSONCarStateMessage
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user