Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abhayachauhan/70c14395e9f1f8a6d819 to your computer and use it in GitHub Desktop.
Save abhayachauhan/70c14395e9f1f8a6d819 to your computer and use it in GitHub Desktop.
{
"provider": {
"name": "Event API"
},
"consumer": {
"name": "Consumer"
},
"interactions": [
{
"description": "a request to retrieve all events",
"provider_state": "there are three events",
"request": {
"method": "get",
"path": "/events",
"headers": {
"Accept": "application/json"
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json; charset=utf-8"
},
"body": [
{
"eventId": "45d80d13-d5a2-48d7-8353-cbb4c0eaabf5",
"timestamp": "2014-06-30T01:37:41.0660548",
"eventType": "SearchView"
},
{
"eventId": "83f9262f-28f1-4703-ab1a-8cfd9e8249c9",
"timestamp": "2014-06-30T01:37:52.2618864",
"eventType": "DetailsView"
},
{
"eventId": "3e83a96b-2a0c-49b1-9959-26df23f83aeb",
"timestamp": "2014-06-30T01:38:00.8518952",
"eventType": "SearchView"
}
]
},
"responseMatchingRules": {
"body": {
"$.[0].eventId": {
"match": "type"
},
"$.[0].timestamp": {
"regex": "^\\d{4}(-|\\/)((0[1-9])|(1[0-2]))(-|\\/)((0[1-9])|([1-2][0-9])|(3[0-1]))(T|\\s)(([0-1][0-9])|(2[0-3])):([0-5][0-9]):([0-5][0-9])"
},
"$.[0].eventType": {
"match": "type"
},
"$.[1].eventId": {
"match": "type"
},
"$.[1].timestamp": {
"regex": "^\\d{5}(-|\\/)((0[1-9])|(1[0-2]))(-|\\/)((0[1-9])|([1-2][0-9])|(3[0-1]))(T|\\s)(([0-1][0-9])|(2[0-3])):([0-5][0-9]):([0-5][0-9])"
},
"$.[1].eventType": {
"match": "type"
},
"$.[2].eventId": {
"match": "type"
},
"$.[2].timestamp": {
"regex": "^\\d{4}(-|\\/)((0[1-9])|(1[0-2]))(-|\\/)((0[1-9])|([1-2][0-9])|(3[0-1]))(T|\\s)(([0-1][0-9])|(2[0-3])):([0-5][0-9]):([0-5][0-9])"
},
"$.[2].eventType": {
"match": "type"
}
}
}
}
],
"metadata": {
"pactSpecificationVersion": "1.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment