JSONSchema 没有捕捉到不正确的附加字段?

JSONSchema not catching incorrect additional fields?

使用 this schema, this file 不会捕获 parties/identifier 下的 name_enlegalName_en 字段,即使在 identifier 上指定了 additionalProperties: false 属性.

这是与:

 jsonschema schema.json -i file.json

在 OSX 上,使用 python-jsonschema

我是不是做错了什么,或者这是一个错误?

我不认为这是一个错误 - 至少如果它是它也是 http://www.jsonschemavalidator.net/ 使用的处理器中的一个错误。

奇怪的是,在其他实例中,验证器遵守它的地方指定了 additionalProperties:false。 packageInfo 部分中有四个属性被捕获,例如:

Property 'documentation_en' has not been defined and the schema does not allow additional properties. Schema path: http://standard.open-contracting.org/schema/1__1__0/release-schema.json#/properties/packageInfo/properties/publisher/additionalProperties

如果我从 packageInfo 部分删除多余的属性,则整个有效负载都可以正常验证。

然后我从 Identity 定义中删除了 patternProperties 属性,验证器开始工作。因此,关于定义中 patternProperties 的存在或值的某些事情正在阻止 additionalProperties 验证工作,这是我所能推测的。

此外,不仅仅是 patternProperties 的存在充当开关。我在 packageInfo 定义中添加了 patternProperties 属性 以查看它是否阻止了验证器验证 4 个多余的属性,但它仍然有效。所以它一定是别的东西。很神秘。