Skip to content

Commit e27a27e

Browse files
committed
Fix UnionType ImportError
1 parent f5f53c3 commit e27a27e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

flask_openapi3/request.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
# @Time : 2022/4/1 16:54
44
import json
55
from json import JSONDecodeError
6-
from types import UnionType
7-
from typing import Any, Type, Optional, Dict, get_origin, get_args, Union, TypeVar
6+
7+
from typing import Any, Type, Optional, Dict, get_origin, get_args, Union
8+
9+
try:
10+
from types import UnionType # Python 3.10+
11+
except ImportError:
12+
UnionType = type(Union)
813

914
from flask import request, current_app, abort
1015
from pydantic import ValidationError, BaseModel, RootModel

0 commit comments

Comments
 (0)