@@ -288,9 +288,9 @@ module.exports = {
288
288
// The complexity is 10.
289
289
if ( size < 8 ) {
290
290
// Finds the number of requests that would be generated from this spec
291
- if ( spec . paths ) {
291
+ if ( _ . isObject ( spec . paths ) ) {
292
292
Object . values ( spec . paths ) . forEach ( ( value ) => {
293
- Object . keys ( value ) . forEach ( ( key ) => {
293
+ _ . keys ( value ) . forEach ( ( key ) => {
294
294
if ( METHODS . includes ( key ) ) {
295
295
numberOfRequests ++ ;
296
296
}
@@ -645,7 +645,7 @@ module.exports = {
645
645
pathLength = currentPath . length ;
646
646
647
647
// get method names available for this path
648
- pathMethods = getPathMethods ( Object . keys ( currentPathObject ) ) ;
648
+ pathMethods = getPathMethods ( _ . keys ( currentPathObject ) ) ;
649
649
650
650
// the number of requests under this node
651
651
currentPathRequestCount = pathMethods . length ;
@@ -724,7 +724,7 @@ module.exports = {
724
724
variableStore = { } ,
725
725
webhooksVariables = [ ] ;
726
726
727
- if ( Object . keys ( webhooksTree . root . children ) . length === 0 ) {
727
+ if ( _ . keys ( webhooksTree . root . children ) . length === 0 ) {
728
728
return ;
729
729
}
730
730
@@ -1059,7 +1059,7 @@ module.exports = {
1059
1059
// with parent folder.
1060
1060
/* eslint-disable max-depth */
1061
1061
if ( resource . childCount === 1 && options . collapseFolders ) {
1062
- let subChild = Object . keys ( resource . children ) [ 0 ] ,
1062
+ let subChild = _ . keys ( resource . children ) [ 0 ] ,
1063
1063
resourceSubChild = resource . children [ subChild ] ;
1064
1064
1065
1065
resourceSubChild . name = resource . name + '/' + resourceSubChild . name ;
@@ -1140,7 +1140,7 @@ module.exports = {
1140
1140
} ;
1141
1141
return false ;
1142
1142
}
1143
- securityDef = _ . get ( openapi , [ 'securityDefs' , Object . keys ( security ) [ 0 ] ] ) ;
1143
+ securityDef = _ . get ( openapi , [ 'securityDefs' , _ . keys ( security ) [ 0 ] ] ) ;
1144
1144
if ( ! _ . isObject ( securityDef ) ) {
1145
1145
return ;
1146
1146
}
@@ -1189,7 +1189,7 @@ module.exports = {
1189
1189
oauth2 : [ ]
1190
1190
} ;
1191
1191
1192
- if ( _ . isObject ( securityDef . flows ) && FLOW_TYPE [ Object . keys ( securityDef . flows ) [ 0 ] ] ) {
1192
+ if ( _ . isObject ( securityDef . flows ) && FLOW_TYPE [ _ . keys ( securityDef . flows ) [ 0 ] ] ) {
1193
1193
/*
1194
1194
1195
1195
//===================[]========================\\
@@ -1209,8 +1209,8 @@ module.exports = {
1209
1209
• "authorization_code_with_pkce"
1210
1210
1211
1211
*/
1212
- currentFlowType = FLOW_TYPE [ Object . keys ( securityDef . flows ) [ 0 ] ] ;
1213
- flowObj = _ . get ( securityDef , `flows.${ Object . keys ( securityDef . flows ) [ 0 ] } ` ) ;
1212
+ currentFlowType = FLOW_TYPE [ _ . keys ( securityDef . flows ) [ 0 ] ] ;
1213
+ flowObj = _ . get ( securityDef , `flows.${ _ . keys ( securityDef . flows ) [ 0 ] } ` ) ;
1214
1214
}
1215
1215
1216
1216
if ( currentFlowType ) { // Means the flow is of supported type
@@ -1219,7 +1219,7 @@ module.exports = {
1219
1219
if ( ! _ . isEmpty ( flowObj . scopes ) ) {
1220
1220
helper . oauth2 . push ( {
1221
1221
key : 'scope' ,
1222
- value : Object . keys ( flowObj . scopes ) . join ( ' ' )
1222
+ value : _ . keys ( flowObj . scopes ) . join ( ' ' )
1223
1223
} ) ;
1224
1224
}
1225
1225
@@ -1408,7 +1408,7 @@ module.exports = {
1408
1408
responseBody : ''
1409
1409
} ;
1410
1410
}
1411
- let headers = Object . keys ( contentObj ) ;
1411
+ let headers = _ . keys ( contentObj ) ;
1412
1412
1413
1413
for ( let i = 0 ; i < headers . length ; i ++ ) {
1414
1414
let headerFamily = this . getHeaderFamily ( headers [ i ] ) ;
@@ -1423,7 +1423,7 @@ module.exports = {
1423
1423
1424
1424
// if no JSON or XML, take whatever we have
1425
1425
if ( ! hasComputedType ) {
1426
- cTypes = Object . keys ( contentObj ) ;
1426
+ cTypes = _ . keys ( contentObj ) ;
1427
1427
if ( cTypes . length > 0 ) {
1428
1428
cTypeHeader = cTypes [ 0 ] ;
1429
1429
hasComputedType = true ;
@@ -1521,7 +1521,7 @@ module.exports = {
1521
1521
return '' ;
1522
1522
}
1523
1523
1524
- exampleKey = Object . keys ( exampleObj ) [ 0 ] ;
1524
+ exampleKey = _ . keys ( exampleObj ) [ 0 ] ;
1525
1525
example = exampleObj [ exampleKey ] ;
1526
1526
// return example value if present else example is returned
1527
1527
@@ -1722,7 +1722,7 @@ module.exports = {
1722
1722
extractDeepObjectParams : function ( deepObject , objectKey ) {
1723
1723
let extractedParams = [ ] ;
1724
1724
1725
- Object . keys ( deepObject ) . forEach ( ( key ) => {
1725
+ _ . keys ( deepObject ) . forEach ( ( key ) => {
1726
1726
let value = deepObject [ key ] ;
1727
1727
if ( value && typeof value === 'object' ) {
1728
1728
extractedParams = _ . concat ( extractedParams , this . extractDeepObjectParams ( value , objectKey + '[' + key + ']' ) ) ;
@@ -2250,12 +2250,12 @@ module.exports = {
2250
2250
previewLanguage = PREVIEW_LANGUAGE . JSON ;
2251
2251
}
2252
2252
}
2253
- else if ( response . content && Object . keys ( response . content ) . length > 0 ) {
2254
- responseHeaders . push ( { key : 'Content-Type' , value : Object . keys ( response . content ) [ 0 ] } ) ;
2255
- if ( this . getHeaderFamily ( Object . keys ( response . content ) [ 0 ] ) === HEADER_TYPE . JSON ) {
2253
+ else if ( response . content && _ . keys ( response . content ) . length > 0 ) {
2254
+ responseHeaders . push ( { key : 'Content-Type' , value : _ . keys ( response . content ) [ 0 ] } ) ;
2255
+ if ( this . getHeaderFamily ( _ . keys ( response . content ) [ 0 ] ) === HEADER_TYPE . JSON ) {
2256
2256
previewLanguage = PREVIEW_LANGUAGE . JSON ;
2257
2257
}
2258
- else if ( this . getHeaderFamily ( Object . keys ( response . content ) [ 0 ] ) === HEADER_TYPE . XML ) {
2258
+ else if ( this . getHeaderFamily ( _ . keys ( response . content ) [ 0 ] ) === HEADER_TYPE . XML ) {
2259
2259
previewLanguage = PREVIEW_LANGUAGE . XML ;
2260
2260
}
2261
2261
else if ( responseBodyWrapper . isJsonLike ) {
@@ -5142,9 +5142,10 @@ module.exports = {
5142
5142
bundleOutput ;
5143
5143
5144
5144
if ( isSwagger ( version ) ) {
5145
- Object . entries ( contentAndComponents . components ) . forEach ( ( [ key , value ] ) => {
5146
- bundledFile [ key ] = value ;
5147
- } ) ;
5145
+ _ . isObject ( contentAndComponents . components ) &&
5146
+ Object . entries ( contentAndComponents . components ) . forEach ( ( [ key , value ] ) => {
5147
+ bundledFile [ key ] = value ;
5148
+ } ) ;
5148
5149
}
5149
5150
else if ( ! _ . isEmpty ( contentAndComponents . components ) ) {
5150
5151
bundledFile . components = contentAndComponents . components ;
0 commit comments