diff --git a/CHANGELOG.md b/CHANGELOG.md index dc465d7821d8a496dc15f364f865b266e066fcc6..2d6b41c8d47d3e89bc3f08a959ef0e74187dca04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### -- Added table_json_conversion.export_import_xlsx with a public function - export_container_to_xlsx, which exports the data of a given Entity +- Added `table_json_conversion.export_import_xlsx` with a public function + `export_container_to_xlsx`, which exports the data of a given Entity Container to a XLSX file. +- Added parameters to the JsonSchemaExporter to + - add `id` property to all RecordTypes + - guess when a reference property probably should be treated like an enum. ### Changed ### diff --git a/src/caosadvancedtools/table_json_conversion/fill_xlsx.py b/src/caosadvancedtools/table_json_conversion/fill_xlsx.py index b47dd56f5e118420c6f649e7b2ecb7aeee541c19..005742f04c62c9e6bd7f6bbc6bcb82cf03096e83 100644 --- a/src/caosadvancedtools/table_json_conversion/fill_xlsx.py +++ b/src/caosadvancedtools/table_json_conversion/fill_xlsx.py @@ -376,7 +376,7 @@ validation_schema: dict, optional template_filler = TemplateFiller(result_wb, graceful=(validation_schema is None)) template_filler.fill_data(data=data) - if isinstance(result, str): + if not isinstance(result, Path): result = Path(result) result.parent.mkdir(parents=True, exist_ok=True) result_wb.save(result) diff --git a/src/caosadvancedtools/table_json_conversion/table_generator.py b/src/caosadvancedtools/table_json_conversion/table_generator.py index 4a5fcd85503b7cb9fc00085012889fa2571444e9..17ed5dac8d4e3a48190ebb58901feb744853fea2 100644 --- a/src/caosadvancedtools/table_json_conversion/table_generator.py +++ b/src/caosadvancedtools/table_json_conversion/table_generator.py @@ -331,7 +331,7 @@ class XLSXTemplateGenerator(TableTemplateGenerator): sheets = self._generate_sheets_from_schema(schema, foreign_keys, use_ids_as_foreign=use_ids_as_foreign) wb = self._create_workbook_from_sheets_def(sheets) - if isinstance(filepath, str): + if not isinstance(filepath, Path): filepath = Path(filepath) parentpath = filepath.parent parentpath.mkdir(parents=True, exist_ok=True) diff --git a/unittests/table_json_conversion/utils.py b/unittests/table_json_conversion/utils.py index aa6b6842d9ccdea83b02bb5efb6e868c4994c943..0134c062358eeee271798e70bed07dc6fd2aa915 100644 --- a/unittests/table_json_conversion/utils.py +++ b/unittests/table_json_conversion/utils.py @@ -43,11 +43,6 @@ allow_name_dict: bool, default=False """ if path is None: path = [] - - # if allow_name_dict: - # if ((isinstance(json1, str) and isinstance(json2, dict)) or - # (isinstance(json2, str) and isinstance(json1, dict))): - # breakpoint() assert isinstance(json1, dict) == isinstance(json2, dict), f"Type mismatch, path: {path}" if isinstance(json1, dict): keys = set(json1.keys()).union(json2.keys())