diff --git a/openapi-gen/templates/python/type.tmpl b/openapi-gen/templates/python/type.tmpl index ac4a4b28..95f7acf7 100644 --- a/openapi-gen/templates/python/type.tmpl +++ b/openapi-gen/templates/python/type.tmpl @@ -26,11 +26,13 @@ {{- end}} {{- end}} -{{- if (not .Schema.Enum)}} +{{- if and (not .Schema.Enum) (not (gt (len .Schema.OneOf) 0))}} from dataclasses import dataclass, field from dataclasses_json import config, dataclass_json -{{else}} +{{else if .Schema.Enum}} from enum import Enum +{{else if (gt (len .Schema.OneOf) 0)}} +from dataclasses import dataclass {{- end}} {{- if .HasNonRequired}}