From 8da6a199a2f7c68e274f744896b7be4108093777 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Wed, 14 Aug 2024 14:54:15 +0100 Subject: [PATCH] Update generator.py --- aiohttp_apischema/generator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aiohttp_apischema/generator.py b/aiohttp_apischema/generator.py index effa2cb..91eae5b 100644 --- a/aiohttp_apischema/generator.py +++ b/aiohttp_apischema/generator.py @@ -1,10 +1,11 @@ import functools import inspect +import sys from collections.abc import Awaitable, Callable, Mapping from http import HTTPStatus from pathlib import Path from types import UnionType -from typing import Any, Literal, Required, TypedDict, TypeGuard, TypeVar, cast, get_args, get_origin +from typing import Any, Literal, TypedDict, TypeGuard, TypeVar, cast, get_args, get_origin from aiohttp import web from aiohttp.hdrs import METH_ALL @@ -13,6 +14,11 @@ from aiohttp_apischema.response import APIResponse +if sys.version_info >= (3, 11): + from typing import Required +else: + from typing_extensions import Required + OPENAPI_METHODS = frozenset({"get", "put", "post", "delete", "options", "head", "patch", "trace"}) _T = TypeVar("_T")