From 3769c376c9f6107abc9892363c6d937e9c315d06 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Jul 2025 10:45:48 +0200 Subject: [PATCH] Do not allow invallid go types in enum generation --- pkg/codegen/codegen.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/codegen/codegen.go b/pkg/codegen/codegen.go index 6e602ea05..46abed0eb 100644 --- a/pkg/codegen/codegen.go +++ b/pkg/codegen/codegen.go @@ -762,6 +762,15 @@ func GenerateEnums(t *template.Template, types []TypeDefinition) (string, error) continue } + // Allow only valid enum types to pass + if tp.Schema.GoType != "string" && + tp.Schema.GoType != "int" || + (tp.Schema.GoType == "array" && + tp.Schema.ArrayType.GoType != "int" && + tp.Schema.ArrayType.GoType != "string") { + continue + } + m[tp.TypeName] = true if len(tp.Schema.EnumValues) > 0 {