...
1
9
10 package openapi
11
12 type Endpoint struct {
13 Name string `json:"name"`
14
15 Exposure string `json:"exposure,omitempty"`
16
17 Path string `json:"path,omitempty"`
18
19 Protocol string `json:"protocol,omitempty"`
20
21 Secure bool `json:"secure,omitempty"`
22
23 TargetPort int32 `json:"targetPort"`
24 }
25
26
27 func AssertEndpointRequired(obj Endpoint) error {
28 elements := map[string]interface{}{
29 "name": obj.Name,
30 "targetPort": obj.TargetPort,
31 }
32 for name, el := range elements {
33 if isZero := IsZeroValue(el); isZero {
34 return &RequiredError{Field: name}
35 }
36 }
37
38 return nil
39 }
40
41
42
43 func AssertRecurseEndpointRequired(objSlice interface{}) error {
44 return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
45 aEndpoint, ok := obj.(Endpoint)
46 if !ok {
47 return ErrTypeAssertionError
48 }
49 return AssertEndpointRequired(aEndpoint)
50 })
51 }
52
View as plain text