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:
parent
becc667672
commit
a81b720151
6 changed files with 51 additions and 13 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue