From 1313251fa1148ee6200b91496faef646e54f1b3a Mon Sep 17 00:00:00 2001 From: Malka123456 Date: Wed, 23 Jul 2025 16:46:30 +0530 Subject: [PATCH 1/3] fix(manifests): skip CRDs with kind suffix 'List' during component generation Signed-off-by: Malka Ali malka988276@gmail.com Signed-off-by: Malka123456 --- utils/manifests/generateComponent.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utils/manifests/generateComponent.go b/utils/manifests/generateComponent.go index 9ae4c2cd..3924bb80 100644 --- a/utils/manifests/generateComponent.go +++ b/utils/manifests/generateComponent.go @@ -2,6 +2,7 @@ package manifests import ( "context" + "strings" "cuelang.org/go/cue" "cuelang.org/go/cue/cuecontext" @@ -36,6 +37,17 @@ func GenerateComponents(ctx context.Context, manifest string, resource int, cfg } parsedCrd = cueCtx.BuildExpr(expr) } + kindVal := parsedCrd.LookupPath(cue.ParsePath("spec.names.kind")) + if kindVal.Exists() { + kindStr, err := kindVal.String() + if err != nil { + continue // skip if unable to convert to string + } + if strings.HasSuffix(kindStr, "List") { + continue // skip List kinds + } + } + outDef, err := getDefinitions(parsedCrd, resource, cfg, ctx) if err != nil { // inability to generate component for a single crd should not affect the rest From fd555cc2efd34031245723847aa7e0e23d97024f Mon Sep 17 00:00:00 2001 From: Malka123456 Date: Wed, 23 Jul 2025 17:04:09 +0530 Subject: [PATCH 2/3] update in openapi_generator.go to ignore somethingList Signed-off-by: Malka Ali malka988276@gmail.com Signed-off-by: Malka123456 --- utils/component/openapi_generator.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/component/openapi_generator.go b/utils/component/openapi_generator.go index c40a3961..819f2f14 100644 --- a/utils/component/openapi_generator.go +++ b/utils/component/openapi_generator.go @@ -57,11 +57,15 @@ func GenerateFromOpenAPI(resource string, pkg models.Package) ([]component.Compo if err != nil { continue } + kind, err := kindCue.String() if err != nil { fmt.Printf("%v", err) continue } + if strings.HasSuffix(kind, "List") { + continue // Skip List types like PodList, DeploymentList, etc. + } crd, err := fieldVal.MarshalJSON() if err != nil { From 35e64e73143072f028e5f1a1bb2b16d8b0ed3bd0 Mon Sep 17 00:00:00 2001 From: Malka Ali <154986373+Malka123456@users.noreply.github.com> Date: Fri, 25 Jul 2025 18:02:47 +0530 Subject: [PATCH 3/3] Update utils/manifests/generateComponent.go Instead of directly accessing the kind via parsedCrd.LookupPath(cue.ParsePath("spec.names.kind")), consider utilizing the NameExtractor from the cfg.CrdFilter configuration. Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Malka Ali <154986373+Malka123456@users.noreply.github.com> --- utils/manifests/generateComponent.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/utils/manifests/generateComponent.go b/utils/manifests/generateComponent.go index 3924bb80..b587ddf1 100644 --- a/utils/manifests/generateComponent.go +++ b/utils/manifests/generateComponent.go @@ -37,16 +37,17 @@ func GenerateComponents(ctx context.Context, manifest string, resource int, cfg } parsedCrd = cueCtx.BuildExpr(expr) } - kindVal := parsedCrd.LookupPath(cue.ParsePath("spec.names.kind")) - if kindVal.Exists() { - kindStr, err := kindVal.String() - if err != nil { - continue // skip if unable to convert to string - } - if strings.HasSuffix(kindStr, "List") { - continue // skip List kinds - } - } +kindVal, err := cfg.CrdFilter.NameExtractor(parsedCrd) +if err == nil { + kindStr, strErr := kindVal.String() + if strErr != nil { + // TODO: Add logging for this error to aid debugging. + continue // skip if unable to convert to string + } + if strings.HasSuffix(kindStr, "List") { + continue // skip List kinds + } +} outDef, err := getDefinitions(parsedCrd, resource, cfg, ctx) if err != nil {