add format_checker to validate data

This commit is contained in:
Cayo Puigdefabregas 2024-02-26 16:00:44 +01:00
parent 812ac6ab91
commit 148d28d808
1 changed files with 5 additions and 1 deletions

View File

@ -256,7 +256,11 @@ class ImportForm(forms.Form):
def validate_jsonld(self, line, row):
try:
jsonschema.validate(instance=row, schema=self.json_schema)
jsonschema.validate(
instance=row,
schema=self.json_schema,
format_checker=jsonschema.Draft202012Validator.FORMAT_CHECKER
)
except jsonschema.exceptions.ValidationError as err:
msg = "line {}: {}".format(line+1, err)
return self.exception(msg)