Skip to content
Snippets Groups Projects
Verified Commit 8a4f18a7 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

REFACTOR: Documentation and small changes.

parent a01a74a3
No related branches found
No related tags found
2 merge requests!138Release 0.14.0,!132Automatic XLSX export
Pipeline #63153 passed
...@@ -8,9 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -8,9 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### ### Added ###
- Added table_json_conversion.export_import_xlsx with a public function - Added `table_json_conversion.export_import_xlsx` with a public function
export_container_to_xlsx, which exports the data of a given Entity `export_container_to_xlsx`, which exports the data of a given Entity
Container to a XLSX file. 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 ### ### Changed ###
......
...@@ -376,7 +376,7 @@ validation_schema: dict, optional ...@@ -376,7 +376,7 @@ validation_schema: dict, optional
template_filler = TemplateFiller(result_wb, graceful=(validation_schema is None)) template_filler = TemplateFiller(result_wb, graceful=(validation_schema is None))
template_filler.fill_data(data=data) template_filler.fill_data(data=data)
if isinstance(result, str): if not isinstance(result, Path):
result = Path(result) result = Path(result)
result.parent.mkdir(parents=True, exist_ok=True) result.parent.mkdir(parents=True, exist_ok=True)
result_wb.save(result) result_wb.save(result)
...@@ -331,7 +331,7 @@ class XLSXTemplateGenerator(TableTemplateGenerator): ...@@ -331,7 +331,7 @@ class XLSXTemplateGenerator(TableTemplateGenerator):
sheets = self._generate_sheets_from_schema(schema, foreign_keys, sheets = self._generate_sheets_from_schema(schema, foreign_keys,
use_ids_as_foreign=use_ids_as_foreign) use_ids_as_foreign=use_ids_as_foreign)
wb = self._create_workbook_from_sheets_def(sheets) wb = self._create_workbook_from_sheets_def(sheets)
if isinstance(filepath, str): if not isinstance(filepath, Path):
filepath = Path(filepath) filepath = Path(filepath)
parentpath = filepath.parent parentpath = filepath.parent
parentpath.mkdir(parents=True, exist_ok=True) parentpath.mkdir(parents=True, exist_ok=True)
......
...@@ -43,11 +43,6 @@ allow_name_dict: bool, default=False ...@@ -43,11 +43,6 @@ allow_name_dict: bool, default=False
""" """
if path is None: if path is None:
path = [] 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}" assert isinstance(json1, dict) == isinstance(json2, dict), f"Type mismatch, path: {path}"
if isinstance(json1, dict): if isinstance(json1, dict):
keys = set(json1.keys()).union(json2.keys()) keys = set(json1.keys()).union(json2.keys())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment