We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
context_getter
Unexpected mypy error for context_getter after v0.254.1.
mypy
I have a working configuration (slimmed down):
import strawberry from fastapi import Depends from strawberry.fastapi import BaseContext, GraphQLRouter class MyContext(BaseContext): def __init__(self) -> None: self.test = "test" @strawberry.type class Query: noop: str = strawberry.field(resolver=lambda: "noop") class MyGraphQLRouter(GraphQLRouter): pass # some unrelated customizations here def get_context(context: MyContext = Depends(MyContext)) -> MyContext: return context schema = strawberry.Schema(Query) router: GraphQLRouter = MyGraphQLRouter(schema, context_getter=get_context) # error here
Before v0.254.1, MyPy used to correctly check this config:
Success: no issues found in 1 source file
But after v0.254.1 (PR #3732), I get a weird error like this:
test.py:27: error: Argument "context_getter" to "MyGraphQLRouter" has incompatible type "Callable[[MyContext], MyContext]"; expected "Callable[..., None] | None" [arg-type] Found 1 error in 1 file (checked 1 source file)
Meanwhile, context_getter is defined like this:
strawberry/strawberry/fastapi/router.py
Line 128 in 2d4234a
Seems quite compatible with what I have.
I susspect, this this behaviour might be caused by this definition:
strawberry/strawberry/http/typevars.py
Line 8 in 2d4234a
The text was updated successfully, but these errors were encountered:
cc: @patrick91
Sorry, something went wrong.
No branches or pull requests
Unexpected
mypy
error forcontext_getter
after v0.254.1.Describe the Bug
I have a working configuration (slimmed down):
Before v0.254.1, MyPy used to correctly check this config:
But after v0.254.1 (PR #3732), I get a weird error like this:
Meanwhile,
context_getter
is defined like this:strawberry/strawberry/fastapi/router.py
Line 128 in 2d4234a
Seems quite compatible with what I have.
I susspect, this this behaviour might be caused by this definition:
strawberry/strawberry/http/typevars.py
Line 8 in 2d4234a
System Information
The text was updated successfully, but these errors were encountered: