1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-06 06:46:14 +01:00

Fix Field.origin_type for Optional types

This commit is contained in:
Daniel Mach 2024-01-23 20:05:11 +01:00
parent 3d7f79b706
commit 86e06a341f

View File

@ -125,7 +125,7 @@ class Field(property):
origin_type = get_origin(self.type) or self.type origin_type = get_origin(self.type) or self.type
if self.is_optional: if self.is_optional:
types = [i for i in self.type.__args__ if i != type(None)] types = [i for i in self.type.__args__ if i != type(None)]
return types[0] return get_origin(types[0]) or types[0]
return origin_type return origin_type
@property @property