Skip to content

Commit

Permalink
only add values to parsed entry list, if it has a value
Browse files Browse the repository at this point in the history
  • Loading branch information
mialy-defelice committed Nov 17, 2023
1 parent bce17f5 commit 0c00e58
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions schematic/schemas/data_model_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ def parse_entry(self, attr: dict, relationship: str) -> Any:
# If the entry should be preserved as a bool dont convert to str.
if rel_val_type == bool and type(attr[relationship]) == bool:
parsed_rel_entry = attr[relationship]
# Move strings to list if they are comma separated. Schema order is preserved.
# Move strings to list if they are comma separated. Schema order is preserved, remove any empty strings added by trailing commas
elif rel_val_type == list:
parsed_rel_entry = attr[relationship].strip().split(",")
parsed_rel_entry = [r.strip() for r in parsed_rel_entry]
parsed_rel_entry = [r.strip() for r in parsed_rel_entry if r]
# Convert value string if dictated by rel_val_type, strip whitespace.
elif rel_val_type == str:
parsed_rel_entry = str(attr[relationship]).strip()
Expand Down

0 comments on commit 0c00e58

Please sign in to comment.