The pact file. Just JSON. { “consumer”: { “name”: “checkout” }, “provider”: { “name”: “catalog” }, “interactions”: [{ “providerStates”: [{ “name”: “a product with id sku-42 is low on stock” }], “request”: { “method”: “GET”, “path”: “/products/sku-42” }, “response”: { “status”: 200, “body”: { “id”: “sku-42”, “name”: “Espresso beans”, “price”: 12.50, “availability”: “LOW_STOCK” }, “matchingRules”: { “body”: { “$.id”: { “match”: “type” }, “$.name”: { “match”: “type” }, “$.price”: { “match”: “decimal” } }} } }] }
The consumer test produces a JSON file. The response body inside is just an example payload, but the matchingRules block is the actual binding contract. Because there is no matcher rule for “availability”, the provider is forced to return the exact string “LOW_STOCK”.
Contract testing for teams that want to move fast
·
webexpo · prague · 2026-05-28
·
robin pokorny
·
robinpokorny.com
19 / 49