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

Resolved issues with cross-manifest validation that occured when a manifest was only a single row #1337

Merged
merged 2 commits into from
Dec 11, 2023
Merged
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
20 changes: 16 additions & 4 deletions schematic/utils/validate_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from schematic import LOADER
from typing import List
import numpy as np
from numbers import Number

def validate_schema(schema):
"""Validate schema against schema.org standard"""
Expand Down Expand Up @@ -75,11 +76,22 @@ def np_array_to_str_list(np_array):
return np.char.mod('%d', np_array).tolist()

def iterable_to_str_list(iterable):
"Parse an iterable into a list of strings"
strlist = []
"""
Parse an object into a list of strings
Accepts str, Number, and iterable inputs
"""

for element in iterable:
strlist.append(str(element))
# If object is a string, just return wrapped as a list
if isinstance(iterable, str):
return [iterable]
# If object is numberical, convert to string and wrap as a list
elif isinstance(iterable, Number):
return [str(iterable)]
# If the object is iterable and not a string, convert every element to string and wratp as a list
else:
strlist = []
for element in iterable:
strlist.append(str(element))

return strlist

Loading