from pydantic import BaseModel, Field from typing import Dict class MyModel(BaseModel): data: Dict[str, int] = Field(min_items=1, max_items=3,strict=True) # 创建一个包含1个键值对的字典 model = MyModel(data={"a": 1})
这个为什么会报错呢,min_items和max_items不能做用于dict类型的字段吗,求大佬解答