下面是schema.json
,city.area.status
的值可以是“ ACTIVE
”或“ INACTIVE
”,
Schema.json
{
"name": "#string",
"city":{
"area": {
"type": "#string",
"status": "ACTIVE"
}
}
}
我正在使用
验证整个架构* match each Response.hits.hits[*]._source == objectCatSchema
除了city.area.status
字段之外,不使用#string
,有什么方法可以验证值是ACTIVE
还是INACTIVE
验证:
* def Response = call read ('`testResponse.json`')
* def expectedSchema = call read ('`citySchema.json`')
* match each `Response.hits.hits[*]._source == objectCatSchema`
答案 0 :(得分:1)
可能还有其他方法,但是您可以使用:
* def statuses = ['ACTIVE', 'INACTIVE']
* def schema = { status: '#? statuses.contains(_)' }
* def response = { status: 'ACTIVE' }
* match response == schema