1

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

0

1 Answer 1

1

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'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.