From 76b43853c9cb051ccc87f58c8ceca2aefb883766 Mon Sep 17 00:00:00 2001 From: sachaarbonel Date: Tue, 19 Sep 2023 00:02:02 +0200 Subject: [PATCH] small improvements --- openapi-gen/templates/python/type.tmpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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}}