Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unflatten: Add new warnings #389

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions flattentool/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,12 @@ def unflatten_main_with_parser(parser, line, timezone, xml, id_name):
new_path = OrderedDict()
list_as_dict[list_index] = new_path
current_path = new_path
if not next_path_item:
dewarning = DataErrorWarning(_(
"Column {} has been ignored, because the schema says it should be an array, but it isn't."
).format(path_till_now))
dewarning.path_till_now = path_till_now
warn(dewarning)
if not xml or num < len(path_list) - 2:
# In xml "arrays" can have text values, if they're the final element
# This corresponds to a tag with text, but also possibly attributes
Expand All @@ -1007,6 +1013,12 @@ def unflatten_main_with_parser(parser, line, timezone, xml, id_name):
)
break
current_path = new_path
if not next_path_item:
dewarning = DataErrorWarning(_(
"Column {} has been ignored, because the schema says it should be an object, but it isn't."
).format(path_till_now))
dewarning.path_till_now = path_till_now
warn(dewarning)
continue
if (
current_type
Expand Down