diff --git a/src/caosadvancedtools/table_json_conversion/table_generator.py b/src/caosadvancedtools/table_json_conversion/table_generator.py index 4e213b835c5e6a15ab6a06b5e430a16a023cbfe4..d769c679c89c289635efc29cfede04d988b5d3c9 100644 --- a/src/caosadvancedtools/table_json_conversion/table_generator.py +++ b/src/caosadvancedtools/table_json_conversion/table_generator.py @@ -204,11 +204,15 @@ class TableTemplateGenerator(ABC): # and add the foreign keys that are necessary up to this point for array_path in array_paths: foreigns = self._get_foreign_keys(foreign_keys, array_path) + if isinstance(foreigns, str): + raise ValueError("Foreign keys must be a list of strings, but a single " + "string was given:\n" + f"{array_path} -> {foreigns}") for foreign in foreigns: internal_key = p2s(array_path + [foreign]) if internal_key in sheets[sheetname]: raise ValueError("The schema would lead to two columns with the same " - f"name, which is forbidden: {internal_key}") + f"name, which is forbidden:\n{foreign} -> {internal_key}") ref_sheet = p2s(array_path) sheets[sheetname][internal_key] = ( ColumnType.FOREIGN, f"see sheet '{ref_sheet}'", array_path + [foreign])