小编Zah*_*kot的帖子

尝试使用 marshmallow 通过 data_key 加载数据时出现“丢失数据”

我尝试在python 3.7上使用marshmallow 2.18.0来验证数据。我等待 json并使用架构加载它:{'name': 'foo', 'emailAddress': 'x@x.org'}

class FooLoad(Schema):
    name = fields.Str()
    email = fields.Email(data_key='emailAddress', required=True)
Run Code Online (Sandbox Code Playgroud)

我除了加载时的data_key会返回一些类似的信息,但我在错误字段中收到错误:{'name': 'foo', 'email': 'x@x.org'}

schema_load = FooLoad()
after_load = schema_load.load({'name': 'foo', 'emailAddress': 'x@x.org'})
after_load.errors # return {'email': ['Missing data for required field.']}
Run Code Online (Sandbox Code Playgroud)

但根据Marshmallow 文档devDependency或 github问题的示例 after_load必须包含类似{'name': 'foo', 'email': 'x@x.org'}.

我想反序列化传入的日期,其名称与架构属性名称不同(指定 date_key 所需的内容,但尝试时出现错误。我如何使用与架构属性不同的名称反序列化输入数据并在此属性的 data_key 字段中声明?

python python-3.x marshmallow

5
推荐指数
1
解决办法
2709
查看次数

(!) 一些块在缩小后大于 500 KiB

在 rRun 上yarn dev它工作正常,但是当我运行时yarn build它显示此错误

(!) Some chunks are larger than 500 kBs after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
Done in 6.03s.
Run Code Online (Sandbox Code Playgroud)

laravel vue.js yarn-workspaces vite

3
推荐指数
1
解决办法
6187
查看次数