@@ -58,46 +58,6 @@ func checkFields(csv *operatorsv1alpha1.ClusterServiceVersion) (errs []errors.Er
5858 return append (result .Errors , result .Warnings ... )
5959}
6060
61- // Recursive function that traverses a nested struct passed in as reflect value, and reports for errors/warnings
62- // in case of null struct field values.
63- func checkMissingFields (result * errors.ManifestResult , v reflect.Value , parentStructName string ) {
64- if v .Kind () != reflect .Struct {
65- return
66- }
67- typ := v .Type ()
68-
69- for i := 0 ; i < v .NumField (); i ++ {
70- fieldValue := v .Field (i )
71- fieldType := typ .Field (i )
72-
73- tag := fieldType .Tag .Get ("json" )
74- // Ignore fields that are subsets of a primitive field.
75- if tag == "" {
76- continue
77- }
78-
79- // Omitted field tags will contain ",omitempty", and ignored tags will
80- // match "-" exactly, respectively.
81- isOptionalField := strings .Contains (tag , ",omitempty" ) || tag == "-"
82- emptyVal := isEmptyValue (fieldValue )
83-
84- newParentStructName := fieldType .Name
85- if parentStructName != "" {
86- newParentStructName = parentStructName + "." + newParentStructName
87- }
88-
89- switch fieldValue .Kind () {
90- case reflect .Struct :
91- updateLog (result , "struct" , newParentStructName , emptyVal , isOptionalField )
92- if ! emptyVal {
93- checkMissingFields (result , fieldValue , newParentStructName )
94- }
95- default :
96- updateLog (result , "field" , newParentStructName , emptyVal , isOptionalField )
97- }
98- }
99- }
100-
10161// Returns updated error log with missing optional/mandatory field/struct objects.
10262func updateLog (result * errors.ManifestResult , typeName string , newParentStructName string , emptyVal bool , isOptionalField bool ) {
10363 if ! emptyVal {
0 commit comments