From 875189c1f7879aa5f778cb77cbaa292967994470 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Fri, 24 Sep 2021 18:04:15 +0100 Subject: [PATCH] unflatten: Add new warnings --- flattentool/input.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/flattentool/input.py b/flattentool/input.py index b8a659e..cbd9096 100644 --- a/flattentool/input.py +++ b/flattentool/input.py @@ -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 @@ -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