Skip to content

Commit 5ed6c43

Browse files
committed
Make variant interfaces private.
1 parent 3605de0 commit 5ed6c43

File tree

2 files changed

+89
-88
lines changed

2 files changed

+89
-88
lines changed

internal/generate/types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,8 @@ func createOneOf(s *openapi3.Schema, name, typeName string) ([]TypeTemplate, []E
760760
variantInterface := ""
761761
if len(variantFields) == 1 && len(variantTypes) == 1 {
762762
variantField = strcase.ToCamel(variantFields[0])
763-
variantInterface = fmt.Sprintf("%s%s", typeName, strcase.ToCamel(variantTypes[0]))
763+
// Note: the variant interface is only used to define the tagged enum, and not of interest to users, so we make it private.
764+
variantInterface = fmt.Sprintf("%s%s", strcase.ToLowerCamel(typeName), strcase.ToCamel(variantTypes[0]))
764765
typeTpls = append(typeTpls, TypeTemplate{
765766
Name: variantInterface,
766767
Type: "interface",

0 commit comments

Comments
 (0)