@@ -248,18 +248,6 @@ module.exports = {
248
248
return { value : 'reference ' + schema . $ref + ' not found in the OpenAPI spec' } ;
249
249
}
250
250
251
- const getAdditionalProperties = ( schema ) => {
252
- let additionalProperties ;
253
- if ( _ . isBoolean ( schema . additionalProperties ) ) {
254
- additionalProperties = schema . additionalProperties ;
255
- }
256
- else {
257
- additionalProperties = this . resolveRefs ( schema . additionalProperties , parameterSourceOption ,
258
- components , schemaResolutionCache , resolveFor , resolveTo , stack , _ . cloneDeep ( seenRef ) , stackLimit ) ;
259
- }
260
- return additionalProperties ;
261
- } ;
262
-
263
251
if (
264
252
concreteUtils . compareTypes ( schema . type , SCHEMA_TYPES . object ) ||
265
253
schema . hasOwnProperty ( 'properties' ) ||
@@ -273,7 +261,13 @@ module.exports = {
273
261
// shallow cloning schema object except properties object
274
262
275
263
if ( _ . has ( schema , 'additionalProperties' ) ) {
276
- tempSchema . additionalProperties = getAdditionalProperties ( schema ) ;
264
+ if ( _ . isBoolean ( schema . additionalProperties ) ) {
265
+ tempSchema . additionalProperties = schema . additionalProperties ;
266
+ }
267
+ else {
268
+ tempSchema . additionalProperties = this . resolveRefs ( schema . additionalProperties , parameterSourceOption ,
269
+ components , schemaResolutionCache , resolveFor , resolveTo , stack , _ . cloneDeep ( seenRef ) , stackLimit ) ;
270
+ }
277
271
}
278
272
279
273
! _ . isEmpty ( schema . properties ) && ( tempSchema . properties = { } ) ;
@@ -344,10 +338,6 @@ module.exports = {
344
338
// without this, schemas with circular references aren't faked correctly
345
339
let tempSchema = _ . omit ( schema , [ 'items' , 'additionalProperties' ] ) ;
346
340
347
- if ( _ . has ( schema , 'additionalProperties' ) ) {
348
- tempSchema . additionalProperties = getAdditionalProperties ( schema ) ;
349
- }
350
-
351
341
tempSchema . items = this . resolveRefs ( schema . items , parameterSourceOption ,
352
342
components , schemaResolutionCache , resolveFor , resolveTo , stack , _ . cloneDeep ( seenRef ) , stackLimit ) ;
353
343
return tempSchema ;
0 commit comments