From 08cb0541a657eae4621cc120e09ac51bb203deee Mon Sep 17 00:00:00 2001 From: Ramon Quitales Date: Fri, 13 Sep 2024 17:08:40 -0700 Subject: [PATCH] fix: properly determine list objects in schemagen --- provider/pkg/gen/schema.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/provider/pkg/gen/schema.go b/provider/pkg/gen/schema.go index 1fdc38eb02..99def6acee 100644 --- a/provider/pkg/gen/schema.go +++ b/provider/pkg/gen/schema.go @@ -366,7 +366,16 @@ func PulumiSchema(swagger map[string]any, opts ...schemaGeneratorOption) pschema for _, kind := range version.Kinds() { tok := fmt.Sprintf(`kubernetes:%s:%s`, kind.apiVersion, kind.kind) var patchTok string - if !strings.HasSuffix(kind.kind, "List") { + + containsItems := false + for _, prop := range kind.Properties() { + if prop.name == "items" { + containsItems = true + break + } + } + + if !(strings.HasSuffix(kind.kind, "List") && containsItems) { patchTok = fmt.Sprintf("%sPatch", tok) }