New API version with additional structures and params
[ric-plt/xapp-frame.git] / pkg / models / format1_action_definition.go
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         "github.com/go-openapi/validate"
16 )
17
18 // Format1ActionDefinition format1 action definition
19 // swagger:model Format1ActionDefinition
20 type Format1ActionDefinition struct {
21
22         // action parameters
23         // Required: true
24         ActionParameters []*ActionParameters `json:"ActionParameters"`
25
26         // style ID
27         // Required: true
28         StyleID *int64 `json:"StyleID"`
29 }
30
31 // Validate validates this format1 action definition
32 func (m *Format1ActionDefinition) Validate(formats strfmt.Registry) error {
33         var res []error
34
35         if err := m.validateActionParameters(formats); err != nil {
36                 res = append(res, err)
37         }
38
39         if err := m.validateStyleID(formats); err != nil {
40                 res = append(res, err)
41         }
42
43         if len(res) > 0 {
44                 return errors.CompositeValidationError(res...)
45         }
46         return nil
47 }
48
49 func (m *Format1ActionDefinition) validateActionParameters(formats strfmt.Registry) error {
50
51         if err := validate.Required("ActionParameters", "body", m.ActionParameters); err != nil {
52                 return err
53         }
54
55         for i := 0; i < len(m.ActionParameters); i++ {
56                 if swag.IsZero(m.ActionParameters[i]) { // not required
57                         continue
58                 }
59
60                 if m.ActionParameters[i] != nil {
61                         if err := m.ActionParameters[i].Validate(formats); err != nil {
62                                 if ve, ok := err.(*errors.Validation); ok {
63                                         return ve.ValidateName("ActionParameters" + "." + strconv.Itoa(i))
64                                 }
65                                 return err
66                         }
67                 }
68
69         }
70
71         return nil
72 }
73
74 func (m *Format1ActionDefinition) validateStyleID(formats strfmt.Registry) error {
75
76         if err := validate.Required("StyleID", "body", m.StyleID); err != nil {
77                 return err
78         }
79
80         return nil
81 }
82
83 // MarshalBinary interface implementation
84 func (m *Format1ActionDefinition) MarshalBinary() ([]byte, error) {
85         if m == nil {
86                 return nil, nil
87         }
88         return swag.WriteJSON(m)
89 }
90
91 // UnmarshalBinary interface implementation
92 func (m *Format1ActionDefinition) UnmarshalBinary(b []byte) error {
93         var res Format1ActionDefinition
94         if err := swag.ReadJSON(b, &res); err != nil {
95                 return err
96         }
97         *m = res
98         return nil
99 }