Skip to content

Commit d12d7a1

Browse files
authored
do not render enum constants if not specified as options (#35)
1 parent 1cb851e commit d12d7a1

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pkg/generators/snippets/enum.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ func GenerateEnumSetter(inputType *types.Type, enumOptions []string) (string, ge
2323
raw := ""
2424

2525
for _, val := range enumOptions {
26-
raw += fmt.Sprintf(`const $.name$%s $.name$ = "%s"`, toSuffix(val), val)
27-
raw += "\n"
26+
if val != "" {
27+
raw += fmt.Sprintf(`const $.name$%s $.name$ = "%s"`, toSuffix(val), val)
28+
raw += "\n"
29+
}
2830
}
2931

3032
return raw, args

0 commit comments

Comments
 (0)