Skip to content

Commit ebb2846

Browse files
committed
fix: add request property to EventBridge schema
1 parent 9ea4d43 commit ebb2846

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

lib/apiGateway/schema.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ const proxiesSchemas = {
308308
eventBusName: stringOrRef.required(),
309309
source: eventBridgeSource.required(),
310310
detailType: eventBridgeDetailType,
311-
detail: eventBridgeDetail
311+
detail: eventBridgeDetail,
312+
request
312313
})
313314
})
314315
}

lib/apiGateway/validate.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,5 +2271,26 @@ describe('#validateServiceProxies()', () => {
22712271

22722272
expect(() => serverlessApigatewayServiceProxy.validateServiceProxies()).to.not.throw()
22732273
})
2274+
2275+
it('should throw error if eventbridge request is missing the template property', () => {
2276+
serverlessApigatewayServiceProxy.serverless.service.custom = {
2277+
apiGatewayServiceProxies: [
2278+
{
2279+
eventbridge: {
2280+
eventBusName: 'yourBus',
2281+
source: 'proxy.apigw',
2282+
path: 'eventbridge',
2283+
method: 'post',
2284+
request: { xxx: { 'application/json': 'mappingTemplate' } }
2285+
}
2286+
}
2287+
]
2288+
}
2289+
2290+
expect(() => serverlessApigatewayServiceProxy.validateServiceProxies()).to.throw(
2291+
serverless.classes.Error,
2292+
'child "eventbridge" fails because [child "request" fails because [child "template" fails because ["template" is required]]]'
2293+
)
2294+
})
22742295
})
22752296
})

0 commit comments

Comments
 (0)