Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions utils/component/openapi_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <resource>List types like PodList, DeploymentList, etc.
}

crd, err := fieldVal.MarshalJSON()
if err != nil {
Expand Down
13 changes: 13 additions & 0 deletions utils/manifests/generateComponent.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package manifests

import (
"context"
"strings"

"cuelang.org/go/cue"
"cuelang.org/go/cue/cuecontext"
Expand Down Expand Up @@ -36,6 +37,18 @@ func GenerateComponents(ctx context.Context, manifest string, resource int, cfg
}
parsedCrd = cueCtx.BuildExpr(expr)
}
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 {
// inability to generate component for a single crd should not affect the rest
Expand Down