From bb2526bc884325442ab45b437b9a508e7bf6ace6 Mon Sep 17 00:00:00 2001 From: Nicolas Roeser Date: Sun, 18 Jun 2023 16:59:20 +0200 Subject: [PATCH] Migrate from validictory to jsonschema Jsonschema by default uses the latest version of the schema validator if not specified otherwise, which is fine. The "required" property in JSON Schema is specified to be an array since draft-fge-json-schema-validation-00 so this commit changes the license schema specification accordingly. --- compile.py | 6 +++--- requirements.txt | 2 +- schema/license.json | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/compile.py b/compile.py index 7f6a7b1..bb63ca7 100755 --- a/compile.py +++ b/compile.py @@ -18,7 +18,7 @@ import os.path import sys import json -import validictory +import jsonschema import audit if sys.version_info < (3,): @@ -76,8 +76,8 @@ def validate(stream): def valid_schema(obj): try: - validictory.validate(obj, schema) - except validictory.validator.RequiredFieldValidationError: + jsonschema.validate(obj, schema) + except jsonschema.exceptions.ValidationError: print("Failure to validate {id}".format(**obj)) raise diff --git a/requirements.txt b/requirements.txt index 4261601..03cd456 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -validictory +jsonschema boto diff --git a/schema/license.json b/schema/license.json index f9b71fc..bbb1eee 100644 --- a/schema/license.json +++ b/schema/license.json @@ -14,7 +14,6 @@ } } }, - "required": true, "type": "array" }, "keywords": { @@ -37,7 +36,6 @@ }, "type": "object" }, - "required": true, "type": "array" }, "name": { @@ -58,11 +56,9 @@ }, "type": "object" }, - "required": true, "type": "array" }, "superseded_by": { - "required": false, "type": [ "null", "string" @@ -86,5 +82,10 @@ "type": "array" } }, + "required": [ + "identifiers", + "links", + "other_names" + ], "type": "object" }