Skip to content

Update jsonschema.protocols #12484

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

Closed
wants to merge 7 commits into from
Closed
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
16 changes: 9 additions & 7 deletions stubs/jsonschema/jsonschema/protocols.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@ from collections.abc import Iterator, Mapping, Sequence
from typing import ClassVar, Protocol
from typing_extensions import TypeAlias

from jsonschema import _typing
from jsonschema._format import FormatChecker
from jsonschema._types import TypeChecker
from jsonschema.exceptions import ValidationError
from jsonschema.validators import RefResolver
from referencing.jsonschema import SchemaRegistry

_JsonParameter: TypeAlias = str | int | float | bool | None | Mapping[str, _JsonParameter] | Sequence[_JsonParameter]

class Validator(Protocol):
META_SCHEMA: ClassVar[dict[Incomplete, Incomplete]]
VALIDATORS: ClassVar[dict[Incomplete, Incomplete]]
META_SCHEMA: ClassVar[Mapping[Incomplete, Incomplete]]
VALIDATORS: ClassVar[Mapping[Incomplete, Incomplete]]
TYPE_CHECKER: ClassVar[TypeChecker]
FORMAT_CHECKER: ClassVar[FormatChecker]
schema: dict[Incomplete, Incomplete] | bool
ID_OF: _typing.id_of
schema: Mapping[Incomplete, Incomplete] | bool
def __init__(
self,
schema: dict[Incomplete, Incomplete] | bool,
resolver: RefResolver | None = None,
schema: Mapping[Incomplete, Incomplete] | bool,
registry: SchemaRegistry,
format_checker: FormatChecker | None = None,
) -> None: ...
@classmethod
def check_schema(cls, schema: dict[Incomplete, Incomplete]) -> None: ...
def check_schema(cls, schema: Mapping[Incomplete, Incomplete]) -> None: ...
def is_type(self, instance: _JsonParameter, type: str) -> bool: ...
def is_valid(self, instance: _JsonParameter) -> bool: ...
def iter_errors(self, instance: _JsonParameter) -> Iterator[ValidationError]: ...
Expand Down