我正在为 python 使用 jsonschema python 包。 我有以下架构:
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "name": { "type": "string", "minLength": 5 } }, "additionalProperties": false }
此外,我还有以下JSON文件需要验证:
{ name: "Josh" }
当我根据上面的模式验证我的 JSON 文件时,我收到错误:
'Josh' is too short
有没有办法指定预期的最小长度? 像这样的东西:
The string 'Josh' is less than the minimum length of 5
我试过:
这些操作都没有改变原始错误消息。
谢谢