Skip to content

Commit

Permalink
Last fix was completely wrong, it only worked because it set doc = []
Browse files Browse the repository at this point in the history
Trying again.
  • Loading branch information
tetron authored and mr-c committed Dec 11, 2020
1 parent 9cc98a6 commit d443e39
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 27 deletions.
29 changes: 17 additions & 12 deletions schema_salad/metaschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,18 +408,23 @@ def __init__(self, inner, scoped_id, vocab_term, scoped_ref):
def load(self, doc, baseuri, loadingOptions, docRoot=None):
# type: (Any, str, LoadingOptions, Optional[str]) -> Any
if isinstance(doc, MutableSequence):
doc = [
expand_url(
i,
baseuri,
loadingOptions,
self.scoped_id,
self.vocab_term,
self.scoped_ref,
)
for i in doc
]
if isinstance(doc, str):
newdoc = []
for i in doc:
if isinstance(i, str):
newdoc.append(
expand_url(
i,
baseuri,
loadingOptions,
self.scoped_id,
self.vocab_term,
self.scoped_ref,
)
)
else:
newdoc.append(i)
doc = newdoc
elif isinstance(doc, str):
doc = expand_url(
doc,
baseuri,
Expand Down
30 changes: 15 additions & 15 deletions schema_salad/python_codegen_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,23 +403,23 @@ def __init__(self, inner, scoped_id, vocab_term, scoped_ref):
def load(self, doc, baseuri, loadingOptions, docRoot=None):
# type: (Any, str, LoadingOptions, Optional[str]) -> Any
if isinstance(doc, MutableSequence):
doc = []
newdoc = []
for i in doc:
if not isinstance(i, str):
raise ValidationException(
f"Expected a list of strings, but item was {type(i)}"
)
doc.append(
expand_url(
i,
baseuri,
loadingOptions,
self.scoped_id,
self.vocab_term,
self.scoped_ref,
if isinstance(i, str):
newdoc.append(
expand_url(
i,
baseuri,
loadingOptions,
self.scoped_id,
self.vocab_term,
self.scoped_ref,
)
)
)
if isinstance(doc, str):
else:
newdoc.append(i)
doc = newdoc
elif isinstance(doc, str):
doc = expand_url(
doc,
baseuri,
Expand Down

0 comments on commit d443e39

Please sign in to comment.