(object interface{})
| 60 | } |
| 61 | |
| 62 | func (v *schemaValidation) validateList(object interface{}) []error { |
| 63 | fields, ok := object.(map[string]interface{}) |
| 64 | if !ok || fields == nil { |
| 65 | return []error{errors.New("invalid object to validate")} |
| 66 | } |
| 67 | |
| 68 | allErrors := []error{} |
| 69 | if _, ok := fields["items"].([]interface{}); !ok { |
| 70 | return []error{errors.New("invalid object to validate")} |
| 71 | } |
| 72 | for _, item := range fields["items"].([]interface{}) { |
| 73 | if gvk, errs := getObjectKind(item); errs != nil { |
| 74 | allErrors = append(allErrors, errs...) |
| 75 | } else { |
| 76 | allErrors = append(allErrors, v.validateResource(item, gvk)...) |
| 77 | } |
| 78 | } |
| 79 | return allErrors |
| 80 | } |
| 81 | |
| 82 | func (v *schemaValidation) validateResource(obj interface{}, gvk schema.GroupVersionKind) []error { |
| 83 | // This lazy-loads the OpenAPI V2 specifications, caching the specs. |
no test coverage detected