Skip to content

Commit fd1693e

Browse files
committed
[fix] edge case where only a single group registered
1 parent 358120b commit fd1693e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/oqd_dataschema/group.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,13 @@ def clear(cls):
149149
@property
150150
def union(cls):
151151
"""Get the current Union of all registered types"""
152-
return Annotated[
153-
Union[tuple(cls.groups.values())], Discriminator(discriminator="class_")
154-
]
152+
153+
if len(cls.groups) > 1:
154+
return Annotated[
155+
Union[tuple(cls.groups.values())], Discriminator(discriminator="class_")
156+
]
157+
else:
158+
return next(iter(cls.groups.values()))
155159

156160
@property
157161
def adapter(cls):

0 commit comments

Comments
 (0)