🐛 fix(endpoints.py): add validation to ensure that custom components are in a single category
This commit is contained in:
parent
2be7a88687
commit
b772bbe976
1 changed files with 7 additions and 0 deletions
|
|
@ -57,6 +57,13 @@ def get_all():
|
||||||
logger.info(f"Loading {len(custom_component_dicts)} category(ies)")
|
logger.info(f"Loading {len(custom_component_dicts)} category(ies)")
|
||||||
for custom_component_dict in custom_component_dicts:
|
for custom_component_dict in custom_component_dicts:
|
||||||
# custom_component_dict is a dict of 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]
|
category = list(custom_component_dict.keys())[0]
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Loading {len(custom_component_dict[category])} component(s) from category {category}"
|
f"Loading {len(custom_component_dict[category])} component(s) from category {category}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue