Skip to content

Commit 6ca7505

Browse files
srittauAlexWaygood
andauthored
Bump jsonschema to 4.19.* (#10583)
Co-authored-by: Alex Waygood <[email protected]>
1 parent 49b717c commit 6ca7505

File tree

6 files changed

+48
-20
lines changed

6 files changed

+48
-20
lines changed

stubs/jsonschema/METADATA.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
version = "4.17.*"
1+
version = "4.19.*"
22
upstream_repository = "https://github.com/python-jsonschema/jsonschema"
3+
requires = ["referencing"]
34
partial_stub = true
45

56
[tool.stubtest]
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from collections.abc import Callable, Iterable
2+
from typing import Any, Protocol
3+
from typing_extensions import TypeAlias
4+
5+
from jsonschema.protocols import Validator
6+
from referencing.jsonschema import Schema
7+
8+
class SchemaKeywordValidator(Protocol):
9+
def __call__(self, validator: Validator, value: Any, instance: Any, schema: Schema) -> None: ...
10+
11+
id_of: TypeAlias = Callable[[Schema], str | None] # noqa: Y042
12+
13+
ApplicableValidators: TypeAlias = Callable[[Schema], Iterable[tuple[str, Any]]]

stubs/jsonschema/jsonschema/_utils.pyi

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class URIDict(MutableMapping[str, str]):
1313

1414
class Unset: ...
1515

16-
def load_schema(name): ...
1716
def format_as_index(container: str, indices) -> str: ...
1817
def find_additional_properties(
1918
instance: Iterable[Incomplete], schema: Mapping[Incomplete, Incomplete]

stubs/jsonschema/jsonschema/validators.pyi

+33-18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ from contextlib import contextmanager
44
from typing import Any, ClassVar
55
from typing_extensions import TypeAlias
66

7+
from referencing.jsonschema import Schema, SchemaRegistry
8+
from referencing.typing import URI
9+
710
from ._format import FormatChecker
811
from ._types import TypeChecker
912
from ._utils import Unset, URIDict
@@ -14,8 +17,6 @@ _JsonObject: TypeAlias = Mapping[str, Any]
1417
_JsonValue: TypeAlias = _JsonObject | list[Any] | str | int | float | bool | None
1518
_ValidatorCallback: TypeAlias = Callable[[Any, Any, _JsonValue, _JsonObject], Iterator[ValidationError]]
1619

17-
_Schema: TypeAlias = Mapping[str, Any]
18-
1920
# This class does not exist at runtime. Compatible classes are created at
2021
# runtime by create().
2122
class _Validator:
@@ -24,31 +25,45 @@ class _Validator:
2425
TYPE_CHECKER: ClassVar[Incomplete]
2526
FORMAT_CHECKER: ClassVar[Incomplete]
2627
@staticmethod
27-
def ID_OF(schema: _Schema) -> str: ...
28-
schema: _Schema
29-
resolver: Incomplete
30-
format_checker: Incomplete
31-
evolve: Incomplete
32-
def __init__(self, schema: _Schema, resolver: Incomplete | None = ..., format_checker: Incomplete | None = ...) -> None: ...
28+
def ID_OF(contents: Schema) -> URI | None: ...
29+
schema: Schema
30+
format_checker: FormatChecker | None
31+
def __init__(
32+
self,
33+
schema: Schema,
34+
resolver: Incomplete | None = None,
35+
format_checker: FormatChecker | None = None,
36+
*,
37+
registry: SchemaRegistry = ...,
38+
_resolver: Incomplete | None = None,
39+
) -> None: ...
3340
@classmethod
34-
def check_schema(cls, schema: _Schema, format_checker: FormatChecker | Unset = ...) -> None: ...
35-
def iter_errors(self, instance, _schema: _Schema | None = ...) -> Generator[Incomplete, None, None]: ...
41+
def check_schema(cls, schema: Schema, format_checker: FormatChecker | Unset = ...) -> None: ...
42+
@property
43+
def resolver(self): ...
44+
def evolve(self, **changes) -> _Validator: ...
45+
def iter_errors(self, instance, _schema: Schema | None = ...) -> Generator[Incomplete, None, None]: ...
3646
def descend(
37-
self, instance, schema: _Schema, path: Incomplete | None = ..., schema_path: Incomplete | None = ...
47+
self,
48+
instance,
49+
schema: Schema,
50+
path: Incomplete | None = ...,
51+
schema_path: Incomplete | None = ...,
52+
resolver: Incomplete | None = None,
3853
) -> Generator[Incomplete, None, None]: ...
3954
def validate(self, *args, **kwargs) -> None: ...
4055
def is_type(self, instance, type): ...
41-
def is_valid(self, instance, _schema: _Schema | None = ...) -> bool: ...
56+
def is_valid(self, instance, _schema: Schema | None = ...) -> bool: ...
4257

4358
def validates(version: str) -> Callable[..., Incomplete]: ...
4459
def create(
45-
meta_schema: _Schema,
60+
meta_schema: Schema,
4661
validators: Mapping[str, _ValidatorCallback] | tuple[()] = (),
4762
version: Incomplete | None = None,
4863
type_checker: TypeChecker = ...,
4964
format_checker: FormatChecker = ...,
50-
id_of: Callable[[_Schema], str] = ...,
51-
applicable_validators: Callable[[_Schema], Iterable[tuple[str, _ValidatorCallback]]] = ...,
65+
id_of: Callable[[Schema], str] = ...,
66+
applicable_validators: Callable[[Schema], Iterable[tuple[str, _ValidatorCallback]]] = ...,
5267
) -> type[_Validator]: ...
5368
def extend(
5469
validator,
@@ -84,7 +99,7 @@ class RefResolver:
8499
remote_cache: Incomplete | None = None,
85100
) -> None: ...
86101
@classmethod
87-
def from_schema(cls, schema: _Schema, id_of=..., *args, **kwargs): ...
102+
def from_schema(cls, schema: Schema, id_of=..., *args, **kwargs): ...
88103
def push_scope(self, scope) -> None: ...
89104
def pop_scope(self) -> None: ...
90105
@property
@@ -100,5 +115,5 @@ class RefResolver:
100115
def resolve_fragment(self, document, fragment): ...
101116
def resolve_remote(self, uri): ...
102117

103-
def validate(instance: object, schema: _Schema, cls: type[_Validator] | None = None, *args: Any, **kwargs: Any) -> None: ...
104-
def validator_for(schema: _Schema | bool, default=...): ...
118+
def validate(instance: object, schema: Schema, cls: type[_Validator] | None = None, *args: Any, **kwargs: Any) -> None: ...
119+
def validator_for(schema: Schema | bool, default=...): ...

0 commit comments

Comments
 (0)