Skip to content

Commit 114ca5f

Browse files
committed
Fix type-checking with explicit registries
Newer typeshed expects `registry` as a kwarg to Validator init. The default in `jsonschema` is very similar to the default registry, which is suitable for our purposes.
1 parent 78d0181 commit 114ca5f

File tree

1 file changed

+7
-2
lines changed
  • src/check_jsonschema/schema_loader

1 file changed

+7
-2
lines changed

src/check_jsonschema/schema_loader/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import urllib.parse
88

99
import jsonschema
10+
from referencing import Registry
1011

1112
from ..builtin_schemas import get_builtin_schema
1213
from ..formats import FormatOptions, format_checker_for_regex_impl, make_format_checker
@@ -221,7 +222,9 @@ def _check_schema(
221222

222223
# now, construct and apply the actual validator
223224
schema_validator = schema_validator_cls(
224-
validator_cls.META_SCHEMA, format_checker=format_checker
225+
validator_cls.META_SCHEMA,
226+
registry=Registry(),
227+
format_checker=format_checker,
225228
)
226229
for error in schema_validator.iter_errors(schema):
227230
raise jsonschema.exceptions.SchemaError.create_from(error)
@@ -279,6 +282,8 @@ def get_validator(
279282
format_checker = make_format_checker(format_opts, meta_schema_dialect)
280283

281284
meta_validator = meta_validator_class(
282-
schema_validator.META_SCHEMA, format_checker=format_checker
285+
schema_validator.META_SCHEMA,
286+
registry=Registry(),
287+
format_checker=format_checker,
283288
)
284289
return meta_validator

0 commit comments

Comments
 (0)