7
7
8
8
from __future__ import annotations
9
9
10
+ from collections .abc import Callable , Mapping
10
11
from typing import TYPE_CHECKING , Any , ClassVar , Iterable
11
12
import sys
12
13
@@ -78,12 +79,12 @@ class Validator(Protocol):
78
79
79
80
#: An object representing the validator's meta schema (the schema that
80
81
#: describes valid schemas in the given version).
81
- META_SCHEMA : ClassVar [dict ]
82
+ META_SCHEMA : ClassVar [Mapping ]
82
83
83
84
#: A mapping of validation keywords (`str`\s) to functions that
84
85
#: validate the keyword with that name. For more information see
85
86
#: `creating-validators`.
86
- VALIDATORS : ClassVar [dict ]
87
+ VALIDATORS : ClassVar [Mapping ]
87
88
88
89
#: A `jsonschema.TypeChecker` that will be used when validating
89
90
#: :kw:`type` keywords in JSON schemas.
@@ -93,19 +94,22 @@ class Validator(Protocol):
93
94
#: :kw:`format` properties in JSON schemas.
94
95
FORMAT_CHECKER : ClassVar [jsonschema .FormatChecker ]
95
96
96
- #: The schema that was passed in when initializing the object.
97
- schema : dict | bool
97
+ #: A function which given a schema returns its ID.
98
+ ID_OF : Callable [[Any ], str | None ]
99
+
100
+ #: The schema that will be used to validate instances
101
+ schema : Mapping | bool
98
102
99
103
def __init__ (
100
104
self ,
101
- schema : dict | bool ,
105
+ schema : Mapping | bool ,
102
106
resolver : RefResolver | None = None ,
103
107
format_checker : jsonschema .FormatChecker | None = None ,
104
108
) -> None :
105
109
...
106
110
107
111
@classmethod
108
- def check_schema (cls , schema : dict ) -> None :
112
+ def check_schema (cls , schema : Mapping | bool ) -> None :
109
113
"""
110
114
Validate the given schema against the validator's `META_SCHEMA`.
111
115
0 commit comments