diff --git a/lib/src/apigateway/openapi-gateway-lambda.test.ts b/lib/src/apigateway/openapi-gateway-lambda.test.ts index 5167c88..333e723 100644 --- a/lib/src/apigateway/openapi-gateway-lambda.test.ts +++ b/lib/src/apigateway/openapi-gateway-lambda.test.ts @@ -87,8 +87,10 @@ describe('openapi-gateway-lambda', () => { // routes and schemas defined in rest api template.hasResourceProperties('AWS::ApiGateway::RestApi', { Body: { + openapi: '3.0.3', info: { title: 'test api', + version: 'v1', }, paths: { '/users/{id}': { @@ -117,6 +119,7 @@ describe('openapi-gateway-lambda', () => { // cloudwatch metrics enabled by default template.hasResourceProperties('AWS::ApiGateway::Stage', { + StageName: 'tst', MethodSettings: [ { MetricsEnabled: true, diff --git a/lib/src/apigateway/openapi-gateway-lambda.ts b/lib/src/apigateway/openapi-gateway-lambda.ts index d230245..5950a47 100644 --- a/lib/src/apigateway/openapi-gateway-lambda.ts +++ b/lib/src/apigateway/openapi-gateway-lambda.ts @@ -120,6 +120,7 @@ const addLogGroupForTracing = ( }); const deployOptionsAccessLog: StageOptions = { + stageName: props.stage, ...props.deployOptions, accessLogDestination: new LogGroupLogDestination(logGroupAccessLog), accessLogFormat: AccessLogFormat.jsonWithStandardFields(), @@ -133,8 +134,9 @@ const addLogGroupForTracing = ( } return { - deployOptions: props.deployOptions ?? { - metricsEnabled: true, + deployOptions: { + stageName: props.stage, + ...(props.deployOptions ? props.deployOptions : { metricsEnabled: true }), }, }; };