Defined all contracts in a single pact, like in the original example
[demos/example-siren] / consumer / pacts / Siren Order Provider-Siren Order Service.json
1 {
2   "consumer": {
3     "name": "Siren Order Provider"
4   },
5   "interactions": [
6     {
7       "description": "get root",
8       "request": {
9         "method": "GET",
10         "path": "/"
11       },
12       "response": {
13         "body": {
14           "class": [
15             "representation"
16           ],
17           "links": [
18             {
19               "href": "http://localhost:8080/orders",
20               "rel": [
21                 "orders"
22               ]
23             }
24           ]
25         },
26         "generators": {
27           "body": {
28             "$.links[0].href": {
29               "example": "http://localhost:8080/orders",
30               "regex": ".*(\\/orders)$",
31               "type": "MockServerURL"
32             }
33           }
34         },
35         "headers": {
36           "Content-Type": "application/vnd.siren+json"
37         },
38         "matchingRules": {
39           "body": {
40             "$.links[0].href": {
41               "combine": "AND",
42               "matchers": [
43                 {
44                   "match": "regex",
45                   "regex": ".*(\\/orders)$"
46                 }
47               ]
48             }
49           },
50           "header": {}
51         },
52         "status": 200
53       }
54     },
55     {
56       "description": "get all orders",
57       "request": {
58         "method": "GET",
59         "path": "/orders"
60       },
61       "response": {
62         "body": {
63           "class": [
64             "entity"
65           ],
66           "entities": [
67             {
68               "actions": [
69                 {
70                   "href": "http://localhost:8080/orders/1234",
71                   "method": "PUT",
72                   "name": "update"
73                 },
74                 {
75                   "href": "http://localhost:8080/orders/1234",
76                   "method": "DELETE",
77                   "name": "delete"
78                 }
79               ],
80               "class": [
81                 "entity"
82               ],
83               "links": [
84                 {
85                   "href": "http://localhost:8080/orders/1234",
86                   "rel": [
87                     "self"
88                   ]
89                 }
90               ],
91               "properties": {
92                 "id": 1234
93               },
94               "rel": [
95                 "item"
96               ]
97             }
98           ],
99           "links": [
100             {
101               "href": "http://localhost:8080/orders",
102               "rel": [
103                 "self"
104               ]
105             }
106           ]
107         },
108         "generators": {
109           "body": {
110             "$.entities[*].links[0].href": {
111               "example": "http://localhost:8080/orders/1234",
112               "regex": ".*(\\/orders\\/\\d+)$",
113               "type": "MockServerURL"
114             },
115             "$.links[0].href": {
116               "example": "http://localhost:8080/orders",
117               "regex": ".*(\\/orders)$",
118               "type": "MockServerURL"
119             }
120           }
121         },
122         "headers": {
123           "Content-Type": "application/vnd.siren+json"
124         },
125         "matchingRules": {
126           "body": {
127             "$.entities": {
128               "combine": "AND",
129               "matchers": [
130                 {
131                   "match": "type"
132                 }
133               ]
134             },
135             "$.entities[*].actions": {
136               "combine": "AND",
137               "matchers": [
138                 {
139                   "match": "arrayContains",
140                   "variants": [
141                     {
142                       "generators": {
143                         "$.href": {
144                           "example": "http://localhost:8080/orders/1234",
145                           "regex": ".*(\\/orders\\/\\d+)$",
146                           "type": "MockServerURL"
147                         }
148                       },
149                       "index": 0,
150                       "rules": {
151                         "$.href": {
152                           "combine": "AND",
153                           "matchers": [
154                             {
155                               "match": "regex",
156                               "regex": ".*(\\/orders\\/\\d+)$"
157                             }
158                           ]
159                         }
160                       }
161                     },
162                     {
163                       "generators": {
164                         "$.href": {
165                           "example": "http://localhost:8080/orders/1234",
166                           "regex": ".*(\\/orders\\/\\d+)$",
167                           "type": "MockServerURL"
168                         }
169                       },
170                       "index": 1,
171                       "rules": {
172                         "$.href": {
173                           "combine": "AND",
174                           "matchers": [
175                             {
176                               "match": "regex",
177                               "regex": ".*(\\/orders\\/\\d+)$"
178                             }
179                           ]
180                         }
181                       }
182                     }
183                   ]
184                 }
185               ]
186             },
187             "$.entities[*].links[0].href": {
188               "combine": "AND",
189               "matchers": [
190                 {
191                   "match": "regex",
192                   "regex": ".*(\\/orders\\/\\d+)$"
193                 }
194               ]
195             },
196             "$.entities[*].properties.id": {
197               "combine": "AND",
198               "matchers": [
199                 {
200                   "match": "integer"
201                 }
202               ]
203             },
204             "$.links[0].href": {
205               "combine": "AND",
206               "matchers": [
207                 {
208                   "match": "regex",
209                   "regex": ".*(\\/orders)$"
210                 }
211               ]
212             }
213           },
214           "header": {}
215         },
216         "status": 200
217       }
218     },
219     {
220       "description": "delete order",
221       "request": {
222         "matchingRules": {
223           "path": {
224             "combine": "AND",
225             "matchers": [
226               {
227                 "match": "regex",
228                 "regex": "/orders/\\d+"
229               }
230             ]
231           }
232         },
233         "method": "DELETE",
234         "path": "/orders/1234"
235       },
236       "response": {
237         "status": 200
238       }
239     }
240   ],
241   "metadata": {
242     "pact-js": {
243       "version": "10.0.0-beta.59"
244     },
245     "pactRust": {
246       "ffi": "0.2.4",
247       "models": "0.3.1"
248     },
249     "pactSpecification": {
250       "version": "3.0.0"
251     }
252   },
253   "provider": {
254     "name": "Siren Order Service"
255   }
256 }