Upgrade CI scripts dependencies (#1786)

Will allow us to benefit from future fixes in JSON Schema validation.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille 2024-04-16 18:59:12 +02:00 committed by GitHub
parent becc667672
commit a81b720151
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 51 additions and 13 deletions

View file

@ -42,6 +42,12 @@ except ImportError as e:
import_error("jsonschema", "jsonschema", "jsonschema", e)
raise
try:
import referencing
except ImportError as e:
import_error("referencing", "referencing", "referencing", e)
raise
try:
import yaml
except ImportError as e:
@ -50,8 +56,11 @@ except ImportError as e:
def check_schema(filepath, example, schema):
resolver = jsonschema.RefResolver(filepath, schema, handlers={"file": helpers.load_file_from_uri})
validator = jsonschema.Draft202012Validator(schema, resolver)
# $id as a URI with scheme is necessary to make registry resolver work.
schema["$id"] = filepath
registry = referencing.Registry(retrieve=helpers.load_resource_from_uri)
validator = jsonschema.validators.Draft202012Validator(schema, registry=registry)
validator.validate(example)