Skip to content

Commit a5e7696

Browse files
committed
added pact contract
1 parent d68a99e commit a5e7696

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

spring-cloud/spring-cloud-contract-provider/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apply plugin: 'spring-cloud-contract'
22

33
buildscript {
44
repositories {
5+
mavenLocal()
56
mavenCentral()
67
maven { url "http://repo.spring.io/snapshot" }
78
maven { url "http://repo.spring.io/milestone" }
@@ -17,6 +18,7 @@ buildscript {
1718

1819

1920
repositories {
21+
mavenLocal()
2022
mavenCentral()
2123
jcenter()
2224
maven { url "http://repo.spring.io/snapshot" }
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"consumer": {
3+
"name": "ui"
4+
},
5+
"provider": {
6+
"name": "userservice"
7+
},
8+
"interactions": [
9+
{
10+
"description": "a request to POST a person",
11+
"providerState": "provider accepts a new person",
12+
"request": {
13+
"method": "POST",
14+
"path": "/user-service/users",
15+
"headers": {
16+
"Content-Type": "application/json"
17+
},
18+
"body": {
19+
"firstName": "Arthur",
20+
"lastName": "Dent"
21+
}
22+
},
23+
"response": {
24+
"status": 201,
25+
"headers": {
26+
"Content-Type": "application/json;charset=UTF-8"
27+
},
28+
"body": {
29+
"id": 42
30+
},
31+
"matchingRules": {
32+
"$.body": {
33+
"match": "type"
34+
}
35+
}
36+
}
37+
},
38+
{
39+
"description": "a request to PUT a person",
40+
"providerState": "person 42 exists",
41+
"request": {
42+
"method": "PUT",
43+
"path": "/user-service/users/42",
44+
"headers": {
45+
"Content-Type": "application/json"
46+
},
47+
"body": {
48+
"firstName": "Zaphod",
49+
"lastName": "Beeblebrox"
50+
},
51+
"matchingRules": {
52+
"$.body": {
53+
"match": "type"
54+
}
55+
}
56+
},
57+
"response": {
58+
"status": 200,
59+
"headers": {
60+
},
61+
"body": {
62+
"firstName": "Zaphod",
63+
"lastName": "Beeblebrox"
64+
},
65+
"matchingRules": {
66+
"$.body": {
67+
"match": "type"
68+
}
69+
}
70+
}
71+
}
72+
],
73+
"metadata": {
74+
"pactSpecification": {
75+
"version": "2.0.0"
76+
}
77+
}
78+
}

0 commit comments

Comments
 (0)