2727from karapace .schema_type import SchemaType
2828from karapace .typing import JsonObject , SchemaId , Subject , Version , VersionTag
2929from karapace .utils import assert_never , json_decode , json_encode , JSONDecodeError
30- from typing import Any , cast , Final , final
30+ from typing import Any , cast , Final , final , Union
3131
3232import hashlib
3333import logging
@@ -53,11 +53,12 @@ def parse_jsonschema_definition(schema_definition: str) -> Draft7Validator:
5353 Raises:
5454 SchemaError: If `schema_definition` is not a valid Draft7 schema.
5555 """
56- schema = json_decode (schema_definition )
56+ raw_schema = json_decode (schema_definition )
57+ schema = cast (Union [Mapping [str , Any ], bool ], raw_schema )
5758 # TODO: Annotations dictate Mapping[str, Any] here, but we have unit tests that
5859 # use bool values and fail if we assert isinstance(_, dict).
59- Draft7Validator .check_schema (schema ) # type: ignore[arg-type]
60- return Draft7Validator (schema ) # type: ignore[arg-type]
60+ Draft7Validator .check_schema (schema )
61+ return Draft7Validator (schema )
6162
6263
6364def _format_protobuf (schema : str , dependencies : Collection [Dependency ], name : str = "schema.proto" ) -> str :
0 commit comments