Skip to content

v0.2.2

Compare
Choose a tag to compare
@ptrthomas ptrthomas released this 02 Mar 14:08
· 4573 commits to master since this release

Fixed #21 - relative file paths confused the parser into thinking it was xpath
Fixed #22 - archetype package had typo

Now conditional (equality) validation where $ refers to the JSON root is possible using embedded expressions:

Given def temperature = { celsius: 100, fahrenheit: 212 }
Then match temperature == { celsius: '#number', fahrenheit: '#($.celsius * 1.8 + 32)' }

Given def json =
"""
{
  "hotels": [
    { "roomInformation": [{ "roomPrice": 618.4 }], "totalPrice": 618.4  },
    { "roomInformation": [{ "roomPrice": 679.79}], "totalPrice": 679.79 }
  ]
}
"""
Then match each json.hotels == { roomInformation: '#array', totalPrice: '#($.roomInformation[0].roomPrice)' }