...
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 Receiver struct {
35
36
37
38 Name *string `json:"name"`
39 }
40
41
42 func (m *Receiver) Validate(formats strfmt.Registry) error {
43 var res []error
44
45 if err := m.validateName(formats); err != nil {
46 res = append(res, err)
47 }
48
49 if len(res) > 0 {
50 return errors.CompositeValidationError(res...)
51 }
52 return nil
53 }
54
55 func (m *Receiver) validateName(formats strfmt.Registry) error {
56
57 if err := validate.Required("name", "body", m.Name); err != nil {
58 return err
59 }
60
61 return nil
62 }
63
64
65 func (m *Receiver) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
66 return nil
67 }
68
69
70 func (m *Receiver) MarshalBinary() ([]byte, error) {
71 if m == nil {
72 return nil, nil
73 }
74 return swag.WriteJSON(m)
75 }
76
77
78 func (m *Receiver) UnmarshalBinary(b []byte) error {
79 var res Receiver
80 if err := swag.ReadJSON(b, &res); err != nil {
81 return err
82 }
83 *m = res
84 return nil
85 }
86
View as plain text