我的代码中有一个特殊的枚举情况和需要来验证它的名单:验证JSON模式为已知值
{
"status": 10
}
让我们用有效值这个虚构的名单:
var valid = [10, 20, 23, 27];
我怎样才能改变我的JSON模式来验证其中的一个值?
{
type: 'object',
required: ['status'],
properties: {
status: { type: number },
}
}
谢谢!这是我正在寻找的。以下是相关文档:http://json-schema.org/latest/json-schema-validation.html#anchor76 – jocull