We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce16b19 commit 36b7e20Copy full SHA for 36b7e20
ruoyi-fastapi-backend/module_admin/annotation/pydantic_annotation.py
@@ -2,10 +2,13 @@
2
from fastapi import Form, Query
3
from pydantic import BaseModel
4
from pydantic.fields import FieldInfo
5
-from typing import Type
+from typing import Type, TypeVar
6
7
8
-def as_query(cls: Type[BaseModel]):
+BaseModelVar = TypeVar('BaseModelVar', bound=BaseModel)
9
+
10
11
+def as_query(cls: Type[BaseModelVar]) -> Type[BaseModelVar]:
12
"""
13
pydantic模型查询参数装饰器,将pydantic模型用于接收查询参数
14
@@ -43,7 +46,7 @@ async def as_query_func(**data):
43
46
return cls
44
47
45
48
-def as_form(cls: Type[BaseModel]):
49
+def as_form(cls: Type[BaseModelVar]) -> Type[BaseModelVar]:
50
51
pydantic模型表单参数装饰器,将pydantic模型用于接收表单参数
52
0 commit comments