From 5d6580f73fa3af8274a23a7993dc5e86f5a55a9e Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 18 Dec 2023 12:00:00 +0100 Subject: [PATCH] fix validate1 --- idhub/admin/forms.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/idhub/admin/forms.py b/idhub/admin/forms.py index 2649f4b..69e8f3a 100644 --- a/idhub/admin/forms.py +++ b/idhub/admin/forms.py @@ -62,7 +62,8 @@ class ImportForm(forms.Form): self._schema = schema.first() try: self.json_schema = json.loads(self._schema.data) - prop = self.json_schema['properties'] + props = [x for x in self.json_schema["allOf"] if 'properties' in x] + prop = props[0]['properties'] self.properties = prop['credentialSubject']['properties'] except Exception: raise ValidationError("Schema is not valid!") @@ -110,8 +111,10 @@ class ImportForm(forms.Form): return def validate_jsonld(self, line, row): + import pdb; pdb.set_trace() try: - credtools.validate_json(row, self.json_schema) + check = credtools.validate_json(row, self.json_schema) + raise ValidationError("Not valid row") except Exception as e: msg = "line {}: {}".format(line+1, e) self.exception(msg)