...
1
9
10 package openapi
11
12 type Image struct {
13 Name string `json:"name"`
14
15 ImageName string `json:"imageName"`
16
17 Args []string `json:"args"`
18
19 BuildContext string `json:"buildContext"`
20
21 RootRequired bool `json:"rootRequired"`
22
23 Uri string `json:"uri"`
24
25 AutoBuild string `json:"autoBuild"`
26
27
28 Orphan bool `json:"orphan"`
29 }
30
31
32 func AssertImageRequired(obj Image) error {
33 elements := map[string]interface{}{
34 "name": obj.Name,
35 "imageName": obj.ImageName,
36 "args": obj.Args,
37 "buildContext": obj.BuildContext,
38 "rootRequired": obj.RootRequired,
39 "uri": obj.Uri,
40 "autoBuild": obj.AutoBuild,
41 "orphan": obj.Orphan,
42 }
43 for name, el := range elements {
44 if isZero := IsZeroValue(el); isZero {
45 return &RequiredError{Field: name}
46 }
47 }
48
49 return nil
50 }
51
52
53
54 func AssertRecurseImageRequired(objSlice interface{}) error {
55 return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
56 aImage, ok := obj.(Image)
57 if !ok {
58 return ErrTypeAssertionError
59 }
60 return AssertImageRequired(aImage)
61 })
62 }
63
View as plain text