🐛 fix(endpoints.py): add validation to ensure that custom components are in a single category

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-17 22:33:52 -03:00
commit b772bbe976

View file

@ -57,6 +57,13 @@ def get_all():
logger.info(f"Loading {len(custom_component_dicts)} category(ies)")
for custom_component_dict in custom_component_dicts:
# custom_component_dict is a dict of dicts
if len(custom_component_dict) > 1:
raise ValueError(
f"Custom components must be in a single category. Found {len(custom_component_dict)} categories"
)
elif len(custom_component_dict) == 0:
continue
category = list(custom_component_dict.keys())[0]
logger.info(
f"Loading {len(custom_component_dict[category])} component(s) from category {category}"