Skip to content
Merged
Show file tree
Hide file tree
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
24 changes: 14 additions & 10 deletions schema_salad/metaschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,22 +438,23 @@ def load(self, doc, baseuri, loadingOptions, docRoot=None):
r.append({"pattern": d})
elif isinstance(d, dict):
new_dict: Dict[str, Any] = {}
if "pattern" in d:
new_dict["pattern"] = d.pop("pattern")
dict_copy = copy.deepcopy(d)
if "pattern" in dict_copy:
new_dict["pattern"] = dict_copy.pop("pattern")
else:
raise ValidationException(
"Missing pattern in secondaryFiles specification entry: {}".format(
d
)
)
new_dict["required"] = (
d.pop("required") if "required" in d else None
dict_copy.pop("required") if "required" in dict_copy else None
)

if len(d):
if len(dict_copy):
raise ValidationException(
"Unallowed values in secondaryFiles specification entry: {}".format(
d
dict_copy
)
)
r.append(new_dict)
Expand All @@ -464,20 +465,23 @@ def load(self, doc, baseuri, loadingOptions, docRoot=None):
)
elif isinstance(doc, MutableMapping):
new_dict = {}
if "pattern" in doc:
new_dict["pattern"] = doc.pop("pattern")
doc_copy = copy.deepcopy(doc)
if "pattern" in doc_copy:
new_dict["pattern"] = doc_copy.pop("pattern")
else:
raise ValidationException(
"Missing pattern in secondaryFiles specification entry: {}".format(
doc
)
)
new_dict["required"] = doc.pop("required") if "required" in doc else None
new_dict["required"] = (
doc_copy.pop("required") if "required" in doc_copy else None
)

if len(doc):
if len(doc_copy):
raise ValidationException(
"Unallowed values in secondaryFiles specification entry: {}".format(
doc
doc_copy
)
)
r.append(new_dict)
Expand Down
24 changes: 14 additions & 10 deletions schema_salad/python_codegen_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,22 +435,23 @@ def load(self, doc, baseuri, loadingOptions, docRoot=None):
r.append({"pattern": d})
elif isinstance(d, dict):
new_dict: Dict[str, Any] = {}
if "pattern" in d:
new_dict["pattern"] = d.pop("pattern")
dict_copy = copy.deepcopy(d)
if "pattern" in dict_copy:
new_dict["pattern"] = dict_copy.pop("pattern")
else:
raise ValidationException(
"Missing pattern in secondaryFiles specification entry: {}".format(
d
)
)
new_dict["required"] = (
d.pop("required") if "required" in d else None
dict_copy.pop("required") if "required" in dict_copy else None
)

if len(d):
if len(dict_copy):
raise ValidationException(
"Unallowed values in secondaryFiles specification entry: {}".format(
d
dict_copy
)
)
r.append(new_dict)
Expand All @@ -461,20 +462,23 @@ def load(self, doc, baseuri, loadingOptions, docRoot=None):
)
elif isinstance(doc, MutableMapping):
new_dict = {}
if "pattern" in doc:
new_dict["pattern"] = doc.pop("pattern")
doc_copy = copy.deepcopy(doc)
if "pattern" in doc_copy:
new_dict["pattern"] = doc_copy.pop("pattern")
else:
raise ValidationException(
"Missing pattern in secondaryFiles specification entry: {}".format(
doc
)
)
new_dict["required"] = doc.pop("required") if "required" in doc else None
new_dict["required"] = (
doc_copy.pop("required") if "required" in doc_copy else None
)

if len(doc):
if len(doc_copy):
raise ValidationException(
"Unallowed values in secondaryFiles specification entry: {}".format(
doc
doc_copy
)
)
r.append(new_dict)
Expand Down