diff --git a/sanic_ext/extensions/injection/constructor.py b/sanic_ext/extensions/injection/constructor.py index a996717..0075a1d 100644 --- a/sanic_ext/extensions/injection/constructor.py +++ b/sanic_ext/extensions/injection/constructor.py @@ -12,6 +12,7 @@ Tuple, Type, get_args, + get_origin, get_type_hints, ) @@ -89,7 +90,7 @@ def prepare( self.pass_kwargs = True if is_optional(annotation): annotation = get_args(annotation)[0] - if not isclass(annotation): + if not isclass(annotation) and get_origin(annotation) is None: missing.append((param, annotation)) continue if issubclass(annotation, Request):