test.json文件内容如下:
The “test.json” file content is as follows:
{}
去掉json schema中port下的default后,可以校验,但是只提示了keyword;required,具体哪个必选字段却不提示
After removing the "default" under "port" in the schema, it can be verified, but only prompts for keyword: "Required", which specific mandatory field is not prompted
schema.json文件内容如下: The “schema.json” file content is as follows:
test.json文件内容如下: The “test.json” file content is as follows:
{}
去掉json schema中port下的default后,可以校验,但是只提示了keyword;required,具体哪个必选字段却不提示 After removing the "default" under "port" in the schema, it can be verified, but only prompts for keyword: "Required", which specific mandatory field is not prompted
代码如下:
看了源码发现在schema.h里做完必选字段校验后又增加了对string类型的默认值长度defaultValueLength_判断, 以下两次提交,增加了该判断: 6f7dcb30d9d662bada0e7e2ebd75846b8c5b91f3 fa98b5b4b67af335655a8b6843a9d82ae4b731a5
代码为什么只跳过了字符串类型的必选字段,如果含默认值就不报错? 去掉默认值判断后,为何仍无法获取到根节点具体哪个schema字段校验失败?