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

@ -19,6 +19,7 @@
import json
import os
import os.path
import referencing
import urllib.parse
import yaml
@ -84,4 +85,15 @@ def load_file_from_uri(path):
else:
# We have to assume it's YAML because some of the YAML examples
# do not have file extensions.
return yaml.safe_load(f)
return yaml.safe_load(f)
def load_resource_from_uri(path):
"""Load a JSON or YAML JSON Schema, as a `referencing.Resource` object, from
a file:// URI.
"""
contents = load_file_from_uri(path)
resource = referencing.Resource(
contents=contents,
specification=referencing.jsonschema.DRAFT202012
)
return resource