Skip to content

Commit 9e9fe5e

Browse files
(fix) fastapi: context_getter signature to allow Awaitable (#3763)
1 parent 3c0f9e4 commit 9e9fe5e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

RELEASE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Release type: patch
2+
3+
This release adjusts the `context_getter` attribute from the fastapi `GraphQLRouter`
4+
to accept an async callables.

strawberry/fastapi/router.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ def __init__(
125125
keep_alive_interval: float = 1,
126126
debug: bool = False,
127127
root_value_getter: Optional[Callable[[], RootValue]] = None,
128-
context_getter: Optional[Callable[..., Optional[Context]]] = None,
128+
context_getter: Optional[
129+
Callable[..., Union[Optional[Context], Awaitable[Optional[Context]]]]
130+
] = None,
129131
subscription_protocols: Sequence[str] = (
130132
GRAPHQL_TRANSPORT_WS_PROTOCOL,
131133
GRAPHQL_WS_PROTOCOL,

0 commit comments

Comments
 (0)