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

Fix getDocumentationParts limit issue #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
};
};
};