alex.makdessi
2022-08-04 13:12
heres the pact file i'm fetching from the broker:
```{
"consumer": {
"name": "ms.pact-consumer-example-for-php"
},
"provider": {
"name": "ms.pact-provider-example-for-php"
},
"interactions": [
{
"description": "A request for a product",
"providerState": "A produ?ct with id c931b702-f48a-447c-8619-80556f40e82b exists",
"request": {
"method": "GET",
"path": "/api/v1/products/c931b702-f48a-447c-8619-80556f40e82b",
"headers": {
"Content-Type": "application/json"
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": {
"id": "c931b702-f48a-447c-8619-80556f40e82b",
"name": "Drill",
"brand": "Makita"
},
"matchingRules": {
"$.body.id": {
"match": "regex",
"regex": "^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$"
},
"$.body.name": {
"match": "type"
},
"$.body.brand": {
"match": "type"
}
}
}
},
{
"description": "A request for a product",
"providerState": "There is no product with id 9b40cb15-dfcf-496f-9ba2-208312a25527",
"request": {
"method": "GET",
"path": "/api/v1/products/9b40cb15-dfcf-496f-9ba2-208312a25527",
"headers": {
"Content-Type": "application/json"
}
},
"response": {
"status": 404,
"headers": {
"Content-Type": "application/json"
},
"body": {
"error": {
"message": "The product with id \"9b40cb15-dfcf-496f-9ba2-208312a25527\" does not exists",
"app_code": "PRODUCT_NOT_FOUND"
}
},
"matchingRules": {
"$.body.error.message": {
"match": "type"
},
"$.body.error.app_code": {
"match": "type"
}
}
}
}
],
"metadata": {
"pactSpecification": {
"version": "3.0.0"
}
}
}```