From 92d93c1333027d8a19493c431503f3db171efda9 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 15 Dec 2021 11:16:42 -0500 Subject: [PATCH] Schemas can be bools too in newer drafts. --- jsonschema/protocols.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jsonschema/protocols.py b/jsonschema/protocols.py index 1e2689bc3..8589afe01 100644 --- a/jsonschema/protocols.py +++ b/jsonschema/protocols.py @@ -5,7 +5,7 @@ # for reference material on Protocols, see # https://www.python.org/dev/peps/pep-0544/ -from typing import Any, ClassVar, Iterator, Optional +from typing import Any, ClassVar, Iterator, Optional, Union try: from typing import Protocol, runtime_checkable @@ -36,7 +36,7 @@ class Validator(Protocol): """ The protocol to which all validator classes should adhere. - :argument dict schema: the schema that the validator object + :argument schema: the schema that the validator object will validate with. It is assumed to be valid, and providing an invalid schema can lead to undefined behavior. See `Validator.check_schema` to validate a schema first. @@ -66,11 +66,11 @@ class Validator(Protocol): TYPE_CHECKER: ClassVar[TypeChecker] #: The schema that was passed in when initializing the object. - schema: dict + schema: Union[dict, bool] def __init__( self, - schema: dict, + schema: Union[dict, bool], resolver: Optional[RefResolver] = None, format_checker: Optional[FormatChecker] = None, ) -> None: