File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { Construct } from 'constructs' ;
22import type { OpenAPIV3 } from 'openapi-types' ;
33
4- interface SchemaOptions {
5- schema : OpenAPIV3 . SchemaObject ;
4+ interface SchemaOptions < T extends OpenAPIV3 . SchemaObject > {
5+ schema : T ;
66}
77
8- export class Schema extends Construct {
9- private options : SchemaOptions ;
8+ export class Schema <
9+ T extends OpenAPIV3 . SchemaObject = OpenAPIV3 . SchemaObject ,
10+ > extends Construct {
11+ private options : SchemaOptions < T > ;
1012
11- constructor ( scope : Construct , id : string , options : SchemaOptions ) {
13+ constructor ( scope : Construct , id : string , options : SchemaOptions < T > ) {
1214 super ( scope , id ) ;
1315
1416 this . options = options ;
@@ -36,7 +38,7 @@ export class Schema extends Construct {
3638 return [ ] ;
3739 }
3840
39- public synth ( ) : OpenAPIV3 . SchemaObject {
41+ public synth ( ) : T {
4042 return this . options . schema ;
4143 }
4244}
You can’t perform that action at this time.
0 commit comments