...
1
9
10 package openapi
11
12 type Volume struct {
13 Name string `json:"name"`
14
15 Ephemeral bool `json:"ephemeral,omitempty"`
16
17 Size string `json:"size,omitempty"`
18 }
19
20
21 func AssertVolumeRequired(obj Volume) error {
22 elements := map[string]interface{}{
23 "name": obj.Name,
24 }
25 for name, el := range elements {
26 if isZero := IsZeroValue(el); isZero {
27 return &RequiredError{Field: name}
28 }
29 }
30
31 return nil
32 }
33
34
35
36 func AssertRecurseVolumeRequired(objSlice interface{}) error {
37 return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
38 aVolume, ok := obj.(Volume)
39 if !ok {
40 return ErrTypeAssertionError
41 }
42 return AssertVolumeRequired(aVolume)
43 })
44 }
45
View as plain text