forked from WrenchApps/GoWrench
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigAppContractMaps.yaml
More file actions
85 lines (73 loc) · 1.55 KB
/
configAppContractMaps.yaml
File metadata and controls
85 lines (73 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
version: 1
service:
name: "my-app-otel-test"
version: 1.0.0
otel:
enable: true
metricConsoleExport: true
traceConsoleExport: true
collectorUrl: "localhost:4318"
api:
endpoints:
- route: /api/mock
method: post
actionId: mock_mirror
- route: /api/mock
method: get
actionId: mocked
- route: /api/map
method: post
actionId: contract_map
- route: /api/map
method: get
actionId: contract_map2
actions:
- id: mock_mirror
type: httpRequestMock
http:
mock:
mirrorBody: true
- id: mocked
type: httpRequestMock
http:
mock:
body: '{ "customers": [{ "name": "test1", "age": "21" },{ "name": "test2", "age": "22" }] }'
contentType: "application/json"
- id: contract_map
type: httpRequest
trigger:
before:
contractMapId: map_before
http:
request:
method: post
url: 'http://localhost:{{PORT}}/api/mock'
- id: contract_map2
type: httpRequest
trigger:
after:
contractMapId: map_after
http:
request:
method: get
url: 'http://localhost:{{PORT}}/api/mock'
contract:
maps:
- id: map_before
sequence:
- parse
parse:
toArray:
- "phone:phones"
- "address"
- "customer.phone:customer.phones"
- "customer:customers"
- id: map_after
sequence:
- new
- remove
new:
- "customer:{{bodyContext.customers[1]}}"
- "customerName:{{bodyContext.customers[0].name}}"
remove:
- "customers"