Pydantic 参数校验 批量提交 批量校验

 

Standard Library Types - Pydantic https://docs.pydantic.dev/2.7/api/standard_library_types/#typeddict

 


from pydantic import BaseModel
from typing import List
from typing_extensions import TypedDict

# `total=False` means keys are non-required
class Identity(TypedDict, total=True):
name: str
id: int

class Batch(BaseModel):
batch: List[Identity]
posted @ 2024-05-30 14:23  papering  阅读(13)  评论(0编辑  收藏  举报