我尝试在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 字段中声明?
在 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)