在pydantic-reis示例中将dict添加为新字段时,无法验证dict



我正在学习pydantic redis,并尝试在https://github.com/sopherapps/pydantic-redis

通过如下添加新字段CCD_ 1

class Book(Model):
_primary_key_field: str = 'title'
title: str
author: str
published_on: date
in_stock: bool = True
new_field: dict = {}

当我运行这个例子时,它说(最后(:value is not a valid dict (type=type_error.dict)

我也尝试过其他类型,比如new_field: List[int] = [8](然后导入typeing.List(另一方面,当我添加一个具有像int这样的基元类型的新字段时,一切都很好。

我错过了什么?

向致以最良好的问候

我问了作者,结果发现这是一个bug。现在它被修复了,我的例子也起作用了!只需安装最新版本0.1.2,就可以看到一个带有一些嵌套数据的修改示例。工作良好:-(

BR,David

最新更新