Skip to content

Commit 96de503

Browse files
feat(mbe): integrate openapi-generator
Ticket: WP-46222
1 parent f34ee9a commit 96de503

File tree

5 files changed

+521
-41
lines changed

5 files changed

+521
-41
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"test:watch": "jest --watch",
1515
"test:coverage": "jest --coverage",
1616
"lint": "eslint --quiet .",
17-
"generate-test-ssl": "openssl req -x509 -newkey rsa:2048 -keyout test-ssl-key.pem -out test-ssl-cert.pem -days 365 -nodes -subj '/CN=localhost'"
17+
"generate-test-ssl": "openssl req -x509 -newkey rsa:2048 -keyout test-ssl-key.pem -out test-ssl-cert.pem -days 365 -nodes -subj '/CN=localhost'",
18+
"generate-openapi": "npx openapi-generator ./src/masterExpressApi.ts > src/masterExpressApi.openapi.json"
1819
},
1920
"dependencies": {
2021
"bitgo": "^44.2.0",
@@ -34,6 +35,7 @@
3435
"proxyquire": "^2.1.3"
3536
},
3637
"devDependencies": {
38+
"@api-ts/openapi-generator": "^5.7.0",
3739
"@types/body-parser": "^1.17.0",
3840
"@types/connect-timeout": "^1.9.0",
3941
"@types/debug": "^4.1.12",

src/masterExpressApi.openapi.json

Lines changed: 300 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,300 @@
1+
{
2+
"openapi": "3.0.3",
3+
"info": {
4+
"title": "@bitgo/enclaved-bitgo-express",
5+
"version": "1.0.0",
6+
"description": "BitGo Enclaved Express - Secure enclave for BitGo signing operations with mTLS"
7+
},
8+
"paths": {
9+
"/api/{coin}/wallet/generate": {
10+
"post": {
11+
"summary": "Request to generate a new wallet",
12+
"operationId": "api.v1.generateWallet",
13+
"parameters": [
14+
{
15+
"name": "coin",
16+
"in": "path",
17+
"required": true,
18+
"schema": {
19+
"type": "string"
20+
}
21+
},
22+
{
23+
"name": "authorization",
24+
"in": "header",
25+
"schema": {
26+
"type": "string"
27+
}
28+
},
29+
{
30+
"name": "user-agent",
31+
"in": "header",
32+
"schema": {
33+
"type": "string"
34+
}
35+
}
36+
],
37+
"requestBody": {
38+
"content": {
39+
"application/json": {
40+
"schema": {
41+
"type": "object",
42+
"properties": {
43+
"label": {
44+
"type": "string"
45+
},
46+
"enterprise": {
47+
"type": "string"
48+
}
49+
},
50+
"required": [
51+
"label",
52+
"enterprise"
53+
]
54+
}
55+
}
56+
}
57+
},
58+
"responses": {
59+
"200": {
60+
"description": "OK",
61+
"content": {
62+
"application/json": {
63+
"schema": {
64+
"$ref": "#/components/schemas/WalletGenerateResponse"
65+
}
66+
}
67+
}
68+
},
69+
"400": {
70+
"description": "Bad Request",
71+
"content": {
72+
"application/json": {
73+
"schema": {
74+
"$ref": "#/components/schemas/InternalErrorResponse"
75+
}
76+
}
77+
}
78+
},
79+
"500": {
80+
"description": "Internal Server Error",
81+
"content": {
82+
"application/json": {
83+
"schema": {
84+
"$ref": "#/components/schemas/InternalErrorResponse"
85+
}
86+
}
87+
}
88+
}
89+
}
90+
}
91+
},
92+
"/ping": {
93+
"post": {
94+
"summary": "Request to ping the server to check if it is alive",
95+
"operationId": "api.v1.health.pingMasterExpress",
96+
"parameters": [],
97+
"responses": {
98+
"200": {
99+
"description": "OK",
100+
"content": {
101+
"application/json": {
102+
"schema": {
103+
"$ref": "#/components/schemas/PingResponse"
104+
}
105+
}
106+
}
107+
},
108+
"500": {
109+
"description": "Internal Server Error",
110+
"content": {
111+
"application/json": {
112+
"schema": {
113+
"type": "object",
114+
"properties": {
115+
"error": {
116+
"type": "string"
117+
},
118+
"details": {
119+
"type": "string"
120+
}
121+
},
122+
"required": [
123+
"error",
124+
"details"
125+
]
126+
}
127+
}
128+
}
129+
}
130+
}
131+
}
132+
},
133+
"/ping/enclavedExpress": {
134+
"post": {
135+
"summary": "Request to ping the enclaved express server",
136+
"operationId": "api.v1.pingEnclavedExpress",
137+
"parameters": [],
138+
"responses": {
139+
"200": {
140+
"description": "OK",
141+
"content": {
142+
"application/json": {
143+
"schema": {
144+
"type": "object",
145+
"properties": {
146+
"status": {
147+
"type": "string"
148+
},
149+
"enclavedResponse": {
150+
"$ref": "#/components/schemas/enclavedPingResponse"
151+
}
152+
},
153+
"required": [
154+
"status",
155+
"enclavedResponse"
156+
]
157+
}
158+
}
159+
}
160+
},
161+
"500": {
162+
"description": "Internal Server Error",
163+
"content": {
164+
"application/json": {
165+
"schema": {
166+
"$ref": "#/components/schemas/InternalErrorResponse"
167+
}
168+
}
169+
}
170+
}
171+
}
172+
}
173+
},
174+
"/version": {
175+
"get": {
176+
"summary": "Request to get the version of the server",
177+
"operationId": "api.v1.health.getVersion",
178+
"parameters": [],
179+
"responses": {
180+
"200": {
181+
"description": "OK",
182+
"content": {
183+
"application/json": {
184+
"schema": {
185+
"$ref": "#/components/schemas/GetVersionResponse"
186+
}
187+
}
188+
}
189+
},
190+
"500": {
191+
"description": "Internal Server Error",
192+
"content": {
193+
"application/json": {
194+
"schema": {
195+
"type": "object",
196+
"properties": {
197+
"error": {
198+
"type": "string"
199+
},
200+
"details": {
201+
"type": "string"
202+
}
203+
},
204+
"required": [
205+
"error",
206+
"details"
207+
]
208+
}
209+
}
210+
}
211+
}
212+
}
213+
}
214+
}
215+
},
216+
"components": {
217+
"schemas": {
218+
"InternalErrorResponse": {
219+
"title": "InternalErrorResponse",
220+
"type": "object",
221+
"properties": {
222+
"error": {
223+
"type": "string"
224+
},
225+
"details": {
226+
"type": "string"
227+
}
228+
},
229+
"required": [
230+
"error",
231+
"details"
232+
]
233+
},
234+
"WalletGenerateResponse": {
235+
"title": "WalletGenerateResponse",
236+
"type": "object",
237+
"properties": {
238+
"wallet": {},
239+
"userKeychain": {},
240+
"backupKeychain": {},
241+
"bitgoKeychain": {}
242+
},
243+
"required": [
244+
"wallet",
245+
"userKeychain",
246+
"backupKeychain",
247+
"bitgoKeychain"
248+
]
249+
},
250+
"enclavedPingResponse": {
251+
"title": "enclavedPingResponse",
252+
"type": "object",
253+
"properties": {
254+
"status": {
255+
"type": "string"
256+
},
257+
"timeStamp": {
258+
"type": "string"
259+
}
260+
},
261+
"required": [
262+
"status",
263+
"timeStamp"
264+
]
265+
},
266+
"GetVersionResponse": {
267+
"title": "GetVersionResponse",
268+
"type": "object",
269+
"properties": {
270+
"version": {
271+
"type": "string"
272+
},
273+
"name": {
274+
"type": "string"
275+
}
276+
},
277+
"required": [
278+
"version",
279+
"name"
280+
]
281+
},
282+
"PingResponse": {
283+
"title": "PingResponse",
284+
"type": "object",
285+
"properties": {
286+
"status": {
287+
"type": "string"
288+
},
289+
"timeStamp": {
290+
"type": "string"
291+
}
292+
},
293+
"required": [
294+
"status",
295+
"timeStamp"
296+
]
297+
}
298+
}
299+
}
300+
}

0 commit comments

Comments
 (0)