Skip to content
Snippets Groups Projects
Commit d0c7c691 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

DOC: comments

parent 29a0bdf3
No related branches found
No related tags found
4 merge requests!100WIP: Filling XLSX: Seems to be working.,!94ENH: add framework for converting json schema into table templates,!93Filling XLSX: Everything except multiple choice.,!92ENH: xlsx template generator
Pipeline #48098 failed
......@@ -145,6 +145,11 @@ class TableTemplateGenerator(ABC):
""" recursively transforms elements from the schema into column definitions
sheets is modified in place.
Parameters
----------
array_paths: list
a list of path along the way to the current object, where the json contains arrays
Returns
-------
......@@ -156,6 +161,8 @@ class TableTemplateGenerator(ABC):
f"'type' key:\n{schema}\n")
if array_paths is None:
# if this is not set, we are at top level and the top level element may always be an
# array
array_paths = [path]
ctype = ColumnType.SCALAR
......@@ -168,12 +175,11 @@ class TableTemplateGenerator(ABC):
sheetname = ".".join(path)
sheets[sheetname] = self._treat_schema_element(
schema['items'], sheets, path, foreign_keys, len(path),
array_paths=array_paths+[path])
print("Sel", path)
array_paths=array_paths+[path] # since this level is an array, we extend the list
)
for p in array_paths:
keys = self._get_foreign_keys(foreign_keys, p)
for k in keys:
print(k, p)
sheets[sheetname].update({k: (ColumnType.FOREIGN, f"see sheet '{path[0]}'", p+[k])})
# columns are added to the new sheet, thus we do not return columns
return {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment