@@ -111,10 +111,11 @@ module.exports = function() {
111111 return Promise . reject ( err ) ;
112112 } )
113113 . then ( ( ) =>
114- aws . request ( 'APIGateway' , 'getDocumentationParts' , {
115- restApiId : this . restApiId ,
116- limit : 9999 ,
117- } )
114+ this . getDocumentationParts (
115+ { restApiId : this . restApiId , limit : 9999 , } ,
116+ { items : [ ] } ,
117+ this . serverless . providers
118+ )
118119 )
119120 . then ( results => results . items . map (
120121 part => aws . request ( 'APIGateway' , 'deleteDocumentationPart' , {
@@ -136,6 +137,26 @@ module.exports = function() {
136137 } ) ) ;
137138 } ,
138139
140+ getDocumentationParts : function getDocumentationParts ( params , allData , providers ) {
141+ const aws = providers . aws ;
142+ return aws . request ( 'APIGateway' , 'getDocumentationParts' , params )
143+ . then ( ( result ) => {
144+ console . info ( "\ndocumentation parts received: " , result . items . length , ) ;
145+ console . info ( ( result . position ? "position : " + result . position : "" ) ) ;
146+ if ( result . items . length > 0 ) {
147+ allData . items = allData . items . concat ( result . items ) ;
148+ }
149+ if ( result . position ) {
150+ params . position = result . position ;
151+ return getDocumentationParts ( params , allData , providers ) ;
152+ }
153+ else {
154+ console . info ( "total documentation parts received : " , allData . items . length ) ;
155+ return allData ;
156+ }
157+ } ) ;
158+ } ,
159+
139160 getGlobalDocumentationParts : function getGlobalDocumentationParts ( ) {
140161 const globalDocumentation = this . customVars . documentation ;
141162 this . createDocumentationParts ( globalDocumentationParts , globalDocumentation , { } ) ;
@@ -252,4 +273,4 @@ module.exports = function() {
252273
253274 _getDocumentationProperties : getDocumentationProperties
254275 } ;
255- } ;
276+ } ;
0 commit comments