@@ -74,7 +74,7 @@ type Schema = ReferenceObject | SchemaObject;
74
74
if ( ! Array . prototype [ 'flatMap' ] ) {
75
75
// polyfill flatMap
76
76
// TODO remove me when dropping node 10 support
77
- Array . prototype [ 'flatMap' ] = function ( lambda ) {
77
+ Array . prototype [ 'flatMap' ] = function ( lambda ) {
78
78
return Array . prototype . concat . apply ( [ ] , this . map ( lambda ) ) ;
79
79
} ;
80
80
Object . defineProperty ( Array . prototype , 'flatMap' , { enumerable : false } ) ;
@@ -288,6 +288,7 @@ export class SchemaPreprocessor {
288
288
this . handleSerDes ( pschema , nschema , options ) ;
289
289
this . handleReadonly ( pschema , nschema , options ) ;
290
290
this . processDiscriminator ( pschema , nschema , options ) ;
291
+ this . removeExamples ( pschema , nschema , options )
291
292
}
292
293
}
293
294
}
@@ -443,6 +444,20 @@ export class SchemaPreprocessor {
443
444
}
444
445
}
445
446
447
+ private removeExamples (
448
+ parent : OpenAPIV3 . SchemaObject ,
449
+ schema : OpenAPIV3 . SchemaObject ,
450
+ opts ,
451
+ ) {
452
+ if ( schema . type !== 'object' ) return ;
453
+ if ( schema ?. example ) {
454
+ delete schema . example
455
+ }
456
+ if ( schema ?. examples ) {
457
+ delete schema . examples
458
+ }
459
+ }
460
+
446
461
private handleReadonly (
447
462
parent : OpenAPIV3 . SchemaObject ,
448
463
schema : OpenAPIV3 . SchemaObject ,
@@ -591,7 +606,7 @@ export class SchemaPreprocessor {
591
606
) =>
592
607
// if name or ref exists and are equal
593
608
( opParam [ 'name' ] && opParam [ 'name' ] === pathParam [ 'name' ] ) ||
594
- ( opParam [ '$ref' ] && opParam [ '$ref' ] === pathParam [ '$ref' ] ) ;
609
+ ( opParam [ '$ref' ] && opParam [ '$ref' ] === pathParam [ '$ref' ] ) ;
595
610
596
611
// Add Path level query param to list ONLY if there is not already an operation-level query param by the same name.
597
612
for ( const param of parameters ) {
0 commit comments