假设我有以下数据:
{
ids: ['12345'],
images: [{
id: '12345',
}]
}
我知道我可以编写一个架构来强制ID存在,是数组并且具有字符串值。我还可以强制图像的ID是字符串。但是,有没有办法我可以强制以下两个数据块使用JSON模式验证失败?
{
ids: [], // should fail because the id '12345' doesn't exist, and the images array is a different length than the ids array
images: [{
id: '12345',
}]
}
或者:
{
ids: ['54321'],// should fail because 12345 doesn't match any of the ids
images: [{
id: '12345',
}]
}