Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump jsonschema to 4.19.* #10583

Merged
merged 6 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion stubs/jsonschema/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version = "4.17.*"
version = "4.19.*"
upstream_repository = "https://github.com/python-jsonschema/jsonschema"
requires = ["referencing"]
partial_stub = true

[tool.stubtest]
Expand Down
13 changes: 13 additions & 0 deletions stubs/jsonschema/jsonschema/_typing.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from collections.abc import Callable, Iterable
from typing import Any, Protocol
from typing_extensions import TypeAlias

from jsonschema.protocols import Validator
from referencing.jsonschema import Schema

class SchemaKeywordValidator(Protocol):
def __call__(self, validator: Validator, value: Any, instance: Any, schema: Schema) -> None: ...

id_of: TypeAlias = Callable[[Schema], str | None] # noqa: Y042

ApplicableValidators: TypeAlias = Callable[[Schema], Iterable[tuple[str, Any]]]
1 change: 0 additions & 1 deletion stubs/jsonschema/jsonschema/_utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class URIDict(MutableMapping[str, str]):

class Unset: ...

def load_schema(name): ...
def format_as_index(container: str, indices) -> str: ...
def find_additional_properties(
instance: Iterable[Incomplete], schema: Mapping[Incomplete, Incomplete]
Expand Down
51 changes: 33 additions & 18 deletions stubs/jsonschema/jsonschema/validators.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ from contextlib import contextmanager
from typing import Any, ClassVar
from typing_extensions import TypeAlias

from referencing.jsonschema import Schema, SchemaRegistry
from referencing.typing import URI

from ._format import FormatChecker
from ._types import TypeChecker
from ._utils import Unset, URIDict
Expand All @@ -14,8 +17,6 @@ _JsonObject: TypeAlias = Mapping[str, Any]
_JsonValue: TypeAlias = _JsonObject | list[Any] | str | int | float | bool | None
_ValidatorCallback: TypeAlias = Callable[[Any, Any, _JsonValue, _JsonObject], Iterator[ValidationError]]

_Schema: TypeAlias = Mapping[str, Any]

# This class does not exist at runtime. Compatible classes are created at
# runtime by create().
class _Validator:
Expand All @@ -24,31 +25,45 @@ class _Validator:
TYPE_CHECKER: ClassVar[Incomplete]
FORMAT_CHECKER: ClassVar[Incomplete]
@staticmethod
def ID_OF(schema: _Schema) -> str: ...
schema: _Schema
resolver: Incomplete
format_checker: Incomplete
evolve: Incomplete
def __init__(self, schema: _Schema, resolver: Incomplete | None = ..., format_checker: Incomplete | None = ...) -> None: ...
def ID_OF(contents: Schema) -> URI | None: ...
schema: Schema
format_checker: FormatChecker | None
def __init__(
self,
schema: Schema,
resolver: Incomplete | None = None,
format_checker: FormatChecker | None = None,
*,
registry: SchemaRegistry = ...,
_resolver: Incomplete | None = None,
) -> None: ...
@classmethod
def check_schema(cls, schema: _Schema, format_checker: FormatChecker | Unset = ...) -> None: ...
def iter_errors(self, instance, _schema: _Schema | None = ...) -> Generator[Incomplete, None, None]: ...
def check_schema(cls, schema: Schema, format_checker: FormatChecker | Unset = ...) -> None: ...
@property
def resolver(self): ...
def evolve(self, **changes) -> _Validator: ...
def iter_errors(self, instance, _schema: Schema | None = ...) -> Generator[Incomplete, None, None]: ...
def descend(
self, instance, schema: _Schema, path: Incomplete | None = ..., schema_path: Incomplete | None = ...
self,
instance,
schema: Schema,
path: Incomplete | None = ...,
schema_path: Incomplete | None = ...,
resolver: Incomplete | None = None,
) -> Generator[Incomplete, None, None]: ...
def validate(self, *args, **kwargs) -> None: ...
def is_type(self, instance, type): ...
def is_valid(self, instance, _schema: _Schema | None = ...) -> bool: ...
def is_valid(self, instance, _schema: Schema | None = ...) -> bool: ...

def validates(version: str) -> Callable[..., Incomplete]: ...
def create(
meta_schema: _Schema,
meta_schema: Schema,
validators: Mapping[str, _ValidatorCallback] | tuple[()] = (),
version: Incomplete | None = None,
type_checker: TypeChecker = ...,
format_checker: FormatChecker = ...,
id_of: Callable[[_Schema], str] = ...,
applicable_validators: Callable[[_Schema], Iterable[tuple[str, _ValidatorCallback]]] = ...,
id_of: Callable[[Schema], str] = ...,
applicable_validators: Callable[[Schema], Iterable[tuple[str, _ValidatorCallback]]] = ...,
) -> type[_Validator]: ...
def extend(
validator,
Expand Down Expand Up @@ -84,7 +99,7 @@ class RefResolver:
remote_cache: Incomplete | None = None,
) -> None: ...
@classmethod
def from_schema(cls, schema: _Schema, id_of=..., *args, **kwargs): ...
def from_schema(cls, schema: Schema, id_of=..., *args, **kwargs): ...
def push_scope(self, scope) -> None: ...
def pop_scope(self) -> None: ...
@property
Expand All @@ -100,5 +115,5 @@ class RefResolver:
def resolve_fragment(self, document, fragment): ...
def resolve_remote(self, uri): ...

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