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

Commit

Permalink
Fix getDocumentationParts limit issue
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulSumanSolanki committed Dec 23, 2020
1 parent f8836a9 commit 85e0625
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions src/documentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ module.exports = function() {
return Promise.reject(err);
})
.then(() =>
aws.request('APIGateway', 'getDocumentationParts', {
restApiId: this.restApiId,
limit: 9999,
})
this.getDocumentationParts(
{ restApiId: this.restApiId, limit: 9999, },
{ items : [] },
this.serverless.providers
)
)
.then(results => results.items.map(
part => aws.request('APIGateway', 'deleteDocumentationPart', {
Expand All @@ -136,6 +137,26 @@ module.exports = function() {
}));
},

getDocumentationParts: function getDocumentationParts(params, allData, providers) {
const aws = providers.aws;
return aws.request('APIGateway', 'getDocumentationParts', params)
.then((result) => {
console.info("\ndocumentation parts received: ",result.items.length,);
console.info((result.position? "position : "+result.position : "" ));
if(result.items.length > 0) {
allData.items = allData.items.concat(result.items);
}
if (result.position) {
params.position = result.position;
return getDocumentationParts(params, allData, providers);
}
else {
console.info("total documentation parts received : ",allData.items.length);
return allData;
}
});
},

getGlobalDocumentationParts: function getGlobalDocumentationParts() {
const globalDocumentation = this.customVars.documentation;
this.createDocumentationParts(globalDocumentationParts, globalDocumentation, {});
Expand Down Expand Up @@ -252,4 +273,4 @@ module.exports = function() {

_getDocumentationProperties: getDocumentationProperties
};
};
};

0 comments on commit 85e0625

Please sign in to comment.