File tree 1 file changed +2
-3
lines changed
tools/schemacode/src/bidsschematools
1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 9
9
from functools import cache , lru_cache
10
10
from importlib .resources import files
11
11
12
- from jsonschema import ValidationError , validate
12
+ from jsonschema import ValidationError
13
13
from jsonschema .protocols import Validator as JsonschemaValidator
14
14
15
15
from . import __bids_version__ , __version__ , utils
@@ -301,12 +301,11 @@ def filter_schema(schema, **kwargs):
301
301
302
302
def validate_schema (schema : Namespace ):
303
303
"""Validate a schema against the BIDS metaschema."""
304
- metaschema = json .loads (files ("bidsschematools.data" ).joinpath ("metaschema.json" ).read_text ())
305
304
306
305
# validate is put in this try/except clause because the error is sometimes too long to
307
306
# print in the terminal
308
307
try :
309
- validate (instance = schema .to_dict (), schema = metaschema )
308
+ get_schema_validator (). validate (instance = schema .to_dict ())
310
309
except ValidationError as e :
311
310
with tempfile .NamedTemporaryFile (
312
311
prefix = "schema_error_" , suffix = ".txt" , delete = False , mode = "w+"
You can’t perform that action at this time.
0 commit comments