Reputation: 547
In the example bellow if warehouse
is an array, how I can validate a json response like in this example:
Scenario: using karate's simpler alternative to json-schema
* def warehouseLocation = { latitude: '#number', longitude: '#number' }
* def productStructure =
"""
{
id: '#number',
name: '#string',
price: '#number? _ > 0',
tags: '##[_ > 0] #string',
dimensions: {
length: '#number',
width: '#number',
height: '#number'
},
warehouseLocation: '##(warehouseLocation)'
}
"""
* def json = read('products.json')
* match json == '#[] productStructure'
Where I have ti put #array. I've tried different issues, but it doesn't work. Thanks
Upvotes: 1
Views: 1235
Reputation: 58058
Your question is asking for warehouse
which I can't find at all in your example. I assume you are asking for this:
warehouseLocation: '#[] warehouseLocation'
Upvotes: 1