Skip to content

Commit c19b6cb

Browse files
Merge pull request #7247 from BitGo/WP-6196-add-openapi-generator-rc-js
feat(express): Add openapi-generator support
2 parents a7bc064 + 24b9260 commit c19b6cb

29 files changed

+63
-18
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* OpenAPI Generator Configuration
3+
* Custom codec handlers for OpenAPI generation
4+
*/
5+
6+
module.exports = (E) => {
7+
return {
8+
'.': {
9+
JsonFromStringifiedJson: () => E.right({ type: 'string' }),
10+
Optional: (args) => E.right({ ...args[0], nullable: true }),
11+
},
12+
'io-ts-types': {
13+
Json: () => E.right({ type: 'object', properties: {}, required: [] }),
14+
NonEmptyString: () => E.right({ type: 'string', minLength: 1 }),
15+
DateFromISOString: () => E.right({ type: 'string', format: 'date-time' }),
16+
BigIntFromString: () => E.right({ type: 'string' }),
17+
},
18+
'io-ts-bigint': {
19+
BigIntFromString: () => E.right({ type: 'string' }),
20+
NegativeBigIntFromString: () => E.right({ type: 'string' }),
21+
PositiveBigIntFromString: () => E.right({ type: 'string' }),
22+
NonZeroBigIntFromString: () => E.right({ type: 'string' }),
23+
NonNegativeBigIntFromString: () => E.right({ type: 'string' }),
24+
},
25+
'io-ts-numbers': {
26+
NumberFromString: () => E.right({ type: 'string' }),
27+
},
28+
};
29+
};

modules/express/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"description": "Local signing server and proxy for the BitGo platform",
66
"main": "./dist/src/index.js",
7+
"source": "src/typedRoutes/api/index.ts",
78
"types": "./dist/src/index.d.ts",
89
"bin": {
910
"bitgo-express": "./bin/bitgo-express"

modules/express/src/typedRoutes/api/common/calculateMinerFeeInfo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const CalculateMinerFeeInfoResponse = t.type({
3939
* 4. The fee rate (in satoshis per kilobyte)
4040
*
4141
* @operationId express.calculateminerfeeinfo
42+
* @tag express
4243
*/
4344
export const PostCalculateMinerFeeInfo = httpRoute({
4445
path: '/api/v[12]/calculateminerfeeinfo',

modules/express/src/typedRoutes/api/common/decrypt.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const DecryptRequestBody = {
1111
* Decrypt
1212
*
1313
* @operationId express.decrypt
14+
* @tag express
1415
*/
1516
export const PostDecrypt = httpRoute({
1617
path: '/api/v[12]/decrypt',

modules/express/src/typedRoutes/api/common/encrypt.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const EncryptRequestBody = {
1212
* Encrypt
1313
*
1414
* @operationId express.encrypt
15+
* @tag express
1516
*/
1617
export const PostEncrypt = httpRoute({
1718
path: '/api/v[12]/encrypt',

modules/express/src/typedRoutes/api/common/login.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const LoginRequest = {
4242
* Login
4343
*
4444
* @operationId express.login
45+
* @tag express
4546
*/
4647
export const PostLogin = httpRoute({
4748
path: '/api/v[12]/user/login',

modules/express/src/typedRoutes/api/common/ping.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { BitgoExpressError } from '../../schemas/error';
66
* Ping
77
*
88
* @operationId express.ping
9+
* @tag express
910
*/
1011
export const GetPing = httpRoute({
1112
path: '/api/v[12]/ping',

modules/express/src/typedRoutes/api/common/pingExpress.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { BitgoExpressError } from '../../schemas/error';
66
* Ping Express
77
*
88
* @operationId express.pingExpress
9+
* @tag express
910
*/
1011
export const GetPingExpress = httpRoute({
1112
path: '/api/v[12]/pingexpress',

modules/express/src/typedRoutes/api/common/verifyAddress.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const VerifyAddressBody = {
1010
* Verify Address
1111
*
1212
* @operationId express.verifyaddress
13+
* @tag express
1314
*/
1415
export const PostVerifyAddress = httpRoute({
1516
path: '/api/v[12]/verifyaddress',

modules/express/src/typedRoutes/api/v1/acceptShare.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export const AcceptShareRequestBody = {
2222
* When a wallet is shared with a user, they need to accept the share to gain access
2323
* to the wallet according to the permissions granted by the sharing user.
2424
*
25-
* @tag express
2625
* @operationId express.v1.wallet.acceptShare
26+
* @tag express
2727
*/
2828
export const PostAcceptShare = httpRoute({
2929
path: '/api/v1/walletshare/{shareId}/acceptShare',

0 commit comments

Comments
 (0)