Skip to content

Commit b2aaed1

Browse files
authored
Fix jsonschema exception str|int containers (#7981)
schema_path, relative_schema_path, and absolute_schema_path are all (related) attributes of `jsonschema` errors which contain `str | int` but were accidentally annotated as containing `str`. Fix them for accuracy.
1 parent ea16964 commit b2aaed1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stubs/jsonschema/jsonschema/exceptions.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class _Error(Exception):
1414
message: str
1515
path: deque[str | int]
1616
relative_path: deque[str | int]
17-
schema_path: deque[str]
18-
relative_schema_path: deque[str]
17+
schema_path: deque[str | int]
18+
relative_schema_path: deque[str | int]
1919
context: list[ValidationError] | None
2020
cause: Exception | None
2121
validator: protocols.Validator | None
@@ -33,15 +33,15 @@ class _Error(Exception):
3333
validator_value=...,
3434
instance: Any = ...,
3535
schema: Any = ...,
36-
schema_path: Sequence[str] = ...,
36+
schema_path: Sequence[str | int] = ...,
3737
parent: _Error | None = ...,
3838
) -> None: ...
3939
@classmethod
4040
def create_from(cls: type[Self], other: _Error) -> Self: ...
4141
@property
4242
def absolute_path(self) -> Sequence[str | int]: ...
4343
@property
44-
def absolute_schema_path(self) -> Sequence[str]: ...
44+
def absolute_schema_path(self) -> Sequence[str | int]: ...
4545
@property
4646
def json_path(self) -> str: ...
4747
# TODO: this type could be made more precise using TypedDict to

0 commit comments

Comments
 (0)