Skip to content
This repository was archived by the owner on Jul 23, 2021. It is now read-only.

Commit a1a37d4

Browse files
mokamoto12tchock
authored andcommitted
Fix the download documentation for stage options (#120)
1 parent a76e8fb commit a1a37d4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/downloadDocumentation.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
module.exports = {
44
downloadDocumentation: function () {
55
const aws = this.serverless.providers.aws;
6-
const stackName = aws.naming.getStackName(this.serverless.service.provider.stage);
6+
const stackName = aws.naming.getStackName(aws.getStage());
77
return this._getRestApiId(stackName).then((restApiId) => {
88
return aws.request('APIGateway', 'getExport', {
9-
stageName: this.serverless.service.provider.stage,
9+
stageName: aws.getStage(),
1010
restApiId: restApiId,
1111
exportType: 'swagger',
1212
parameters: {
@@ -20,9 +20,10 @@ module.exports = {
2020
},
2121

2222
_getRestApiId: function (stackName) {
23-
return this.serverless.providers.aws.request('CloudFormation', 'describeStacks', {StackName: stackName},
24-
this.serverless.service.provider.stage,
25-
this.serverless.service.provider.region
23+
const aws = this.serverless.providers.aws;
24+
return aws.request('CloudFormation', 'describeStacks', {StackName: stackName},
25+
aws.getStage(),
26+
aws.getRegion()
2627
).then((result) => {
2728
return result.Stacks[0].Outputs
2829
.filter(output => output.OutputKey === 'AwsDocApiId')

src/downloadDocumentation.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ describe('ServerlessAWSDocumentation', function () {
1515
}
1616
},
1717
request: jasmine.createSpy('aws request'),
18+
getStage: () => 'testStage',
19+
getRegion: () => 'testRegion'
1820
}
1921
},
2022
service: {

0 commit comments

Comments
 (0)