From 59332c6858f6f891f9d72a51ca88574f4eb4f947 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 21 May 2022 16:19:02 +0200 Subject: [PATCH] Checked in the generated contract for comparison --- ...en Order Provider-Siren Order Service.json | 256 ++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 consumer/pacts/Siren Order Provider-Siren Order Service.json diff --git a/consumer/pacts/Siren Order Provider-Siren Order Service.json b/consumer/pacts/Siren Order Provider-Siren Order Service.json new file mode 100644 index 0000000..138ef78 --- /dev/null +++ b/consumer/pacts/Siren Order Provider-Siren Order Service.json @@ -0,0 +1,256 @@ +{ + "consumer": { + "name": "Siren Order Provider" + }, + "interactions": [ + { + "description": "get root", + "request": { + "method": "GET", + "path": "/" + }, + "response": { + "body": { + "class": [ + "representation" + ], + "links": [ + { + "href": "http://localhost:8080/orders", + "rel": [ + "orders" + ] + } + ] + }, + "generators": { + "body": { + "$.links[0].href": { + "example": "http://localhost:8080/orders", + "regex": ".*(\\/orders)$", + "type": "MockServerURL" + } + } + }, + "headers": { + "Content-Type": "application/vnd.siren+json" + }, + "matchingRules": { + "body": { + "$.links[0].href": { + "combine": "AND", + "matchers": [ + { + "match": "regex", + "regex": ".*(\\/orders)$" + } + ] + } + }, + "header": {} + }, + "status": 200 + } + }, + { + "description": "get all orders", + "request": { + "method": "GET", + "path": "/orders" + }, + "response": { + "body": { + "class": [ + "entity" + ], + "entities": [ + { + "actions": [ + { + "href": "http://localhost:8080/orders/1234", + "method": "PUT", + "name": "update" + }, + { + "href": "http://localhost:8080/orders/1234", + "method": "DELETE", + "name": "delete" + } + ], + "class": [ + "entity" + ], + "links": [ + { + "href": "http://localhost:8080/orders/1234", + "rel": [ + "self" + ] + } + ], + "properties": { + "id": 1234 + }, + "rel": [ + "item" + ] + } + ], + "links": [ + { + "href": "http://localhost:8080/orders", + "rel": [ + "self" + ] + } + ] + }, + "generators": { + "body": { + "$.entities[*].links[0].href": { + "example": "http://localhost:8080/orders/1234", + "regex": ".*(\\/orders\\/\\d+)$", + "type": "MockServerURL" + }, + "$.links[0].href": { + "example": "http://localhost:8080/orders", + "regex": ".*(\\/orders)$", + "type": "MockServerURL" + } + } + }, + "headers": { + "Content-Type": "application/vnd.siren+json" + }, + "matchingRules": { + "body": { + "$.entities": { + "combine": "AND", + "matchers": [ + { + "match": "type" + } + ] + }, + "$.entities[*].actions": { + "combine": "AND", + "matchers": [ + { + "match": "arrayContains", + "variants": [ + { + "generators": { + "$.href": { + "example": "http://localhost:8080/orders/1234", + "regex": ".*(\\/orders\\/\\d+)$", + "type": "MockServerURL" + } + }, + "index": 0, + "rules": { + "$.href": { + "combine": "AND", + "matchers": [ + { + "match": "regex", + "regex": ".*(\\/orders\\/\\d+)$" + } + ] + } + } + }, + { + "generators": { + "$.href": { + "example": "http://localhost:8080/orders/1234", + "regex": ".*(\\/orders\\/\\d+)$", + "type": "MockServerURL" + } + }, + "index": 1, + "rules": { + "$.href": { + "combine": "AND", + "matchers": [ + { + "match": "regex", + "regex": ".*(\\/orders\\/\\d+)$" + } + ] + } + } + } + ] + } + ] + }, + "$.entities[*].links[0].href": { + "combine": "AND", + "matchers": [ + { + "match": "regex", + "regex": ".*(\\/orders\\/\\d+)$" + } + ] + }, + "$.entities[*].properties.id": { + "combine": "AND", + "matchers": [ + { + "match": "integer" + } + ] + }, + "$.links[0].href": { + "combine": "AND", + "matchers": [ + { + "match": "regex", + "regex": ".*(\\/orders)$" + } + ] + } + }, + "header": {} + }, + "status": 200 + } + }, + { + "description": "delete order", + "request": { + "matchingRules": { + "path": { + "combine": "AND", + "matchers": [ + { + "match": "regex", + "regex": "/orders/\\d+" + } + ] + } + }, + "method": "DELETE", + "path": "/orders/1234" + }, + "response": { + "status": 200 + } + } + ], + "metadata": { + "pact-js": { + "version": "10.0.0-beta.59" + }, + "pactRust": { + "ffi": "0.2.4", + "models": "0.3.1" + }, + "pactSpecification": { + "version": "3.0.0" + } + }, + "provider": { + "name": "Siren Order Service" + } +} \ No newline at end of file -- 2.20.1