From 6c0b876a65245c0fdce86cadbf25cc73f5882139 Mon Sep 17 00:00:00 2001 From: Sean Sullivan Date: Mon, 6 Mar 2023 14:26:33 -0800 Subject: [PATCH] Verifier does not support List --- .../pkg/resource/query_param_verifier_v3.go | 3 +++ .../pkg/resource/query_param_verifier_v3_test.go | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/staging/src/k8s.io/cli-runtime/pkg/resource/query_param_verifier_v3.go b/staging/src/k8s.io/cli-runtime/pkg/resource/query_param_verifier_v3.go index 3d08c202f5ee..82cd024c820b 100644 --- a/staging/src/k8s.io/cli-runtime/pkg/resource/query_param_verifier_v3.go +++ b/staging/src/k8s.io/cli-runtime/pkg/resource/query_param_verifier_v3.go @@ -57,6 +57,9 @@ var namespaceGVK = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Name // or if another error occurred. If the Open API V3 spec for a CRD is not // found, then the spec for Namespace is checked for query param support instead. func (v *queryParamVerifierV3) HasSupport(gvk schema.GroupVersionKind) error { + if (gvk == schema.GroupVersionKind{Version: "v1", Kind: "List"}) { + return NewParamUnsupportedError(gvk, v.queryParam) + } gvSpec, err := v.root.GVSpec(gvk.GroupVersion()) if err == nil { if supports := supportsQueryParamV3(gvSpec, gvk, v.queryParam); supports { diff --git a/staging/src/k8s.io/cli-runtime/pkg/resource/query_param_verifier_v3_test.go b/staging/src/k8s.io/cli-runtime/pkg/resource/query_param_verifier_v3_test.go index 603189e85d5b..6cbf207c065f 100644 --- a/staging/src/k8s.io/cli-runtime/pkg/resource/query_param_verifier_v3_test.go +++ b/staging/src/k8s.io/cli-runtime/pkg/resource/query_param_verifier_v3_test.go @@ -104,6 +104,16 @@ func TestV3SupportsQueryParamBatchV1(t *testing.T) { queryParam: QueryParamFieldValidation, expectedSupports: false, }, + "List GVK is specifically unsupported": { + crds: []schema.GroupKind{}, + gvk: schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "List", + }, + queryParam: QueryParamFieldValidation, + expectedSupports: false, + }, } root := openapi3.NewRoot(cached.NewClient(openapitest.NewFileClient(t)))