[英]How to use additionalProperties with allOf in JSON schema?
考虑这个例子:
"allOf": [
{"$ref": "test-address-prefix-types-base.json#"},
{
"properties": {}, "additionalProperties" : false
}
]}
当我使用Java模式验证器验证时,我收到错误说:
"keyword":"additionalProperties","message":"object instance has properties which are not allowed by the schema: [\"attributes\",\"type\"]"}]
但是针对基本模式验证的相同JSON对象(test-address-prefix-types-base)没有错误地传递。
引用的模式(基础模式)没有设置additionalProperties。
这是我正在使用的json消息:
String message = "{\"data\":{\"attributes\":{" +
"\"notation\": \"A\"," +
"\"prefixType\": \"A\"}" +
",\"type\":\"test-address-prefix-types\"}}";
我在架构中错过了什么吗? 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.