2
唯一键我具有以下JSON数据:JSON模式验证:在JSON数组
[
{
"unique1":{
"id":3
}
},
{
"unique2":{
"id":4
}
}
]
每个阵列项具有与一个顶层唯一密钥JSON对象。 当我尝试为它编写验证模式时,我只能验证完整数组是唯一的,而不是每个数组中的顶级密钥。
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"patternProperties": {
"^.*$": {
}
}
}
}
继JSON数据应无法验证:
[
{
"unique1":{
"id":3
}
},
{
"unique1":{
"id":4
}
}
]