...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package models
18
19
20
21
22 import (
23 "context"
24
25 "github.com/go-openapi/errors"
26 "github.com/go-openapi/strfmt"
27 "github.com/go-openapi/swag"
28 "github.com/go-openapi/validate"
29 )
30
31
32
33
34 type Matcher struct {
35
36
37 IsEqual *bool `json:"isEqual,omitempty"`
38
39
40
41 IsRegex *bool `json:"isRegex"`
42
43
44
45 Name *string `json:"name"`
46
47
48
49 Value *string `json:"value"`
50 }
51
52
53 func (m *Matcher) Validate(formats strfmt.Registry) error {
54 var res []error
55
56 if err := m.validateIsRegex(formats); err != nil {
57 res = append(res, err)
58 }
59
60 if err := m.validateName(formats); err != nil {
61 res = append(res, err)
62 }
63
64 if err := m.validateValue(formats); err != nil {
65 res = append(res, err)
66 }
67
68 if len(res) > 0 {
69 return errors.CompositeValidationError(res...)
70 }
71 return nil
72 }
73
74 func (m *Matcher) validateIsRegex(formats strfmt.Registry) error {
75
76 if err := validate.Required("isRegex", "body", m.IsRegex); err != nil {
77 return err
78 }
79
80 return nil
81 }
82
83 func (m *Matcher) validateName(formats strfmt.Registry) error {
84
85 if err := validate.Required("name", "body", m.Name); err != nil {
86 return err
87 }
88
89 return nil
90 }
91
92 func (m *Matcher) validateValue(formats strfmt.Registry) error {
93
94 if err := validate.Required("value", "body", m.Value); err != nil {
95 return err
96 }
97
98 return nil
99 }
100
101
102 func (m *Matcher) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
103 return nil
104 }
105
106
107 func (m *Matcher) MarshalBinary() ([]byte, error) {
108 if m == nil {
109 return nil, nil
110 }
111 return swag.WriteJSON(m)
112 }
113
114
115 func (m *Matcher) UnmarshalBinary(b []byte) error {
116 var res Matcher
117 if err := swag.ReadJSON(b, &res); err != nil {
118 return err
119 }
120 *m = res
121 return nil
122 }
123
View as plain text