From e79b34ed3585963d46114ff5ca3e161a37e3ec34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Voron?= Date: Fri, 18 Feb 2022 11:04:56 +0100 Subject: [PATCH] Fix #922: allow DependencyCallable type to be generators --- fastapi_users/types.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fastapi_users/types.py b/fastapi_users/types.py index 39b37ca6..6fbe8959 100644 --- a/fastapi_users/types.py +++ b/fastapi_users/types.py @@ -1,7 +1,13 @@ -from typing import Callable, Coroutine, TypeVar, Union +from typing import AsyncGenerator, Callable, Coroutine, Generator, TypeVar, Union RETURN_TYPE = TypeVar("RETURN_TYPE") DependencyCallable = Callable[ - ..., Union[RETURN_TYPE, Coroutine[None, None, RETURN_TYPE]] + ..., + Union[ + RETURN_TYPE, + Coroutine[None, None, RETURN_TYPE], + AsyncGenerator[RETURN_TYPE, None], + Generator[RETURN_TYPE, None, None], + ], ]