mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Merge pull request #9597 from mikedanese/fix-swagger-validate-panic
fix panic in kubectl --validate when no apiVersion is passed
This commit is contained in:
commit
4e6bd63256
@ -79,11 +79,11 @@ func (s *SwaggerSchema) ValidateBytes(data []byte) error {
|
||||
}
|
||||
apiVersion := fields["apiVersion"]
|
||||
if apiVersion == nil {
|
||||
fmt.Errorf("apiVersion not set")
|
||||
return fmt.Errorf("apiVersion not set")
|
||||
}
|
||||
kind := fields["kind"]
|
||||
if kind == nil {
|
||||
fmt.Errorf("kind not set")
|
||||
return fmt.Errorf("kind not set")
|
||||
}
|
||||
return s.ValidateObject(obj, apiVersion.(string), "", apiVersion.(string)+"."+kind.(string))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user