Skip to content
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

Is types-jsonschema outdated in typeshed? #997

Closed
kratsg opened this issue Sep 1, 2022 · 2 comments
Closed

Is types-jsonschema outdated in typeshed? #997

kratsg opened this issue Sep 1, 2022 · 2 comments

Comments

@kratsg
Copy link

kratsg commented Sep 1, 2022

I expected the following code to work when it comes to typing

from typing import Any, Mapping
import jsonschema

store: dict[str, Mapping[str, Any]] = {}

jsonschema.RefResolver(
    base_uri=f"file://mypath.json",
    referrer={},
    store=store
)

However, this gives an error:

test.py:9: error: Argument "store" to "RefResolver" has incompatible type "Dict[str, Mapping[str, Any]]"; expected "Union[SupportsKeysAndGetItem[str, str], Iterable[Tuple[str, str]]]"  [arg-type]
Found 1 error in 1 file (checked 1 source file)

defined at https://github.com/python/typeshed/blob/c1d307fc3bf51488b708e1c71334faccba5fd294/stubs/jsonschema/jsonschema/validators.pyi#L66-L80 . It seems incorrect that store is a dict[str, str] type.

Similarly, referrer is defined as a dict (MutableMapping) but I suspect that could be changed to Mapping (generically).

@Julian
Copy link
Member

Julian commented Sep 1, 2022

Possibly? Did you mean to file this ticket there?

@kratsg
Copy link
Author

kratsg commented Sep 1, 2022

Possibly? Did you mean to file this ticket there?

I wasn't completely sure if this was something you maintained or not - so I wanted to check with the project version before filing with typeshed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants