MCPcopy
hub / github.com/kubernetes/kubectl / validateResource

Method validateResource

pkg/validation/validation.go:82–95  ·  view source on GitHub ↗
(obj interface{}, gvk schema.GroupVersionKind)

Source from the content-addressed store, hash-verified

80}
81
82func (v *schemaValidation) validateResource(obj interface{}, gvk schema.GroupVersionKind) []error {
83 // This lazy-loads the OpenAPI V2 specifications, caching the specs.
84 resources, err := v.resourcesGetter.OpenAPISchema()
85 if err != nil {
86 return []error{err}
87 }
88 resource := resources.LookupResource(gvk)
89 if resource == nil {
90 // resource is not present, let's just skip validation.
91 return nil
92 }
93
94 return validation.ValidateModel(obj, resource, gvk.Kind)
95}
96
97func parse(data []byte) (interface{}, error) {
98 var obj interface{}

Callers 2

ValidateBytesMethod · 0.95
validateListMethod · 0.95

Calls 2

OpenAPISchemaMethod · 0.65
LookupResourceMethod · 0.65

Tested by

no test coverage detected