See #3953. Fix bug where IDSes with a single enumeration value didn't validate.

This commit is contained in:
Dion Moult
2023-11-01 16:28:42 +11:00
parent 20b7ee009d
commit dfd5cc4728
+6 -3
View File
@@ -919,12 +919,15 @@ class Restriction:
return self return self
self.base = ids_dict.get("@base", "xs:string")[3:] self.base = ids_dict.get("@base", "xs:string")[3:]
for key, value in ids_dict.items(): for key, value in ids_dict.items():
key = key.split(":")[-1]
if key in ["@base", "annotation"]: if key in ["@base", "annotation"]:
continue continue
if isinstance(value, dict): if key == "enumeration" and isinstance(value, dict):
self.options[key.split(":")[-1]] = value["@value"] self.options[key] = [value["@value"]] # A single enumeration value which is pretty meaningless
elif isinstance(value, dict):
self.options[key] = value["@value"]
else: else:
self.options[key.split(":")[-1]] = [v["@value"] for v in value] self.options[key] = [v["@value"] for v in value]
return self return self
def asdict(self): def asdict(self):