MingSme
导航
首页
资讯
鸿蒙开发
仓颉
ArkTS
Python
游戏引擎
COCOS
作品展示
交流频道
联系我们
登录
搜索
首页
归档
202401
2024/1/24
Python
FastAPI请求体模型内的属性验证
使用pydantic.Field class UserModel(BaseModel): username: str = Field(..., min_length=3) description: Optional[str] = Field(...
1694阅读
0评论
2024/1/22
Python
FastAPI路径参数的验证
路径参数都是必须项 @app.get('/users/{user_id}') async def get_user(user_id: int = Path(..., title="...
1911阅读
1评论
2024/1/21
Python
FastAPI函数的参数识别规则
如果在路径参数中定义了,那么匹配为路径参数; 如果参数的类型为int,str之类的基本类型,则为查询参数; 如果是pydantic的模型类型,则为请求体。
1671阅读
0评论
2024/1/21
Python
FastAPI为请求体中的数据定义模型
from pydantic import BaseModel class UserModel(BaseModel): username: str description: Optional[str] = None
1586阅读
0评论
2024/1/4
Python
Python 类型提示简介
Python 3.6+ 版本加入了对"类型提示"的支持。 这些"类型提示"是一种新的语法(在 Python 3.6 版本加入)用来声明一个变量的类型。 通过声明变量的类型,编辑器和一些工具能给你提供更好的支持。 这只是一...
1547阅读
0评论
没有更多了~