Skip to content

Instantly share code, notes, and snippets.

@ian-ellis
Created March 23, 2017 01:56
Show Gist options
  • Save ian-ellis/d70400ee3a42ae8deaae051d19c69b57 to your computer and use it in GitHub Desktop.
Save ian-ellis/d70400ee3a42ae8deaae051d19c69b57 to your computer and use it in GitHub Desktop.
V3 Pact File
{
"description": "A request for products",
"request": {
"method": "GET",
"path": "/catalog/products",
"headers": {
"Accept": "application/json"
},
"query": {
"gender": [
"male"
]
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/hal+json"
},
"body": {
"_embedded": {
"product": [
{
"sku": "FR760AA31JSE",
"name": "Alaska Coat",
"ribbon": "new",
"short_description": "A product description",
"price": 169.95,
"special_price": 6352154657,
"link": "Alaska-Coat-217468.html",
"_embedded": {
"brand": {
"id": 1234,
"url_key": "awesome",
"name": "Awesome Brand"
},
"gender": {
"id": 15,
"name": "male"
},
"shops": [
{
"name": "sports",
"is_default": false
}
],
"images": [
{
"url": "http://static.theiconic.com.au/p/fresh-soul-1697-864712-1.jpg"
}
]
}
},
{
"sku": "FR760AA31JSE",
"name": "Alaska Coat",
"ribbon": "new",
"short_description": "A product description",
"price": 169.95,
"special_price": 4205715302,
"link": "Alaska-Coat-217468.html",
"_embedded": {
"brand": {
"id": 1234,
"url_key": "awesome",
"name": "Awesome Brand"
},
"gender": {
"id": 15,
"name": "male"
},
"shops": [
{
"name": "sports",
"is_default": false
}
],
"images": [
{
"url": "http://static.theiconic.com.au/p/fresh-soul-1697-864712-1.jpg"
}
]
}
}
]
},
"_links": {
"self": {
"href": "http://eve.theiconic.com.au/v1/catalog/products?page=1"
}
},
"page_count": 1,
"page_size": 24,
"total_items": 2
},
"matchingRules": {
"body": {
"$._embedded.product": {
"matchers": [
{
"match": "type",
"min": 1
}
]
},
"$._embedded.product[*].sku": {
"matchers": [
{
"match": "type"
}
]
},
"$._embedded.product[*].name": {
"matchers": [
{
"match": "type"
}
]
},
"$._embedded.product[*].ribbon": {
"matchers": [
{
"match": "type"
}
]
},
"$._embedded.product[*].short_description": {
"matchers": [
{
"match": "type"
}
]
},
"$._embedded.product[*].price": {
"matchers": [
{
"match": "number"
}
]
},
"$._embedded.product[*].special_price": {
"matchers": [
{
"match": "number"
}
]
},
"$._embedded.product[*].link": {
"matchers": [
{
"match": "type"
}
]
},
"$._embedded.product[*]._embedded.brand.id": {
"matchers": [
{
"match": "integer"
}
]
},
"$._embedded.product[*]._embedded.brand.url_key": {
"matchers": [
{
"match": "type"
}
]
},
"$._embedded.product[*]._embedded.brand.name": {
"matchers": [
{
"match": "type"
}
]
},
"$._embedded.product[*]._embedded.gender.id": {
"matchers": [
{
"match": "integer"
}
]
},
"$._embedded.product[*]._embedded.gender.name": {
"matchers": [
{
"match": "regex",
"regex": "male|female|unisex"
}
]
},
"$._embedded.product[*]._embedded.shops": {
"matchers": [
{
"match": "type",
"min": 1
}
]
},
"$._embedded.product[*]._embedded.shops[*].name": {
"matchers": [
{
"match": "type"
}
]
},
"$._embedded.product[*]._embedded.images": {
"matchers": [
{
"match": "type",
"min": 1
}
]
},
"$._embedded.product[*]._embedded.images[*].url": {
"matchers": [
{
"match": "type"
}
]
},
"$._links.self.href": {
"matchers": [
{
"match": "type"
}
]
},
"$.page_count": {
"matchers": [
{
"match": "type"
}
]
},
"$.page_size": {
"matchers": [
{
"match": "type"
}
]
},
"$.total_items": {
"matchers": [
{
"match": "type"
}
]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment