From 32fd959e675108265f35139b44d02ba966bd37e2 Mon Sep 17 00:00:00 2001 From: David Perl Date: Fri, 13 Jun 2025 14:26:43 +0200 Subject: [PATCH] fix: allow sets in generated form types --- bec_widgets/utils/forms_from_types/items.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bec_widgets/utils/forms_from_types/items.py b/bec_widgets/utils/forms_from_types/items.py index 17a34143..a46b7e12 100644 --- a/bec_widgets/utils/forms_from_types/items.py +++ b/bec_widgets/utils/forms_from_types/items.py @@ -64,12 +64,12 @@ class FormItemSpec(BaseModel): if isinstance(v, (type, UnionType)): return v if isinstance(v, GenericAlias): - if v.__origin__ in [list, dict] and all( + if v.__origin__ in [list, dict, set] and all( arg in allowed_primitives for arg in v.__args__ ): return v raise ValueError( - f"Generics of type {v} are not supported - only lists and dicts of primitive types {allowed_primitives}" + f"Generics of type {v} are not supported - only lists, dicts and sets of primitive types {allowed_primitives}" ) if type(v) is type(Literal[""]): # _LiteralGenericAlias is not exported from typing arg_types = set(type(arg) for arg in v.__args__)