File tree Expand file tree Collapse file tree 2 files changed +30
-6
lines changed
modules/openapi-generator/src/main/resources/typescript-nestjs-server
samples/server/petstore/typescript-nestjs-server/builds/default Expand file tree Collapse file tree 2 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -7,18 +7,30 @@ import { {{classname}}Controller } from './controllers';
77{ {/apis} }
88{ {/apiInfo} }
99
10+ export type ApiModuleConfiguration = {
11+ /**
12+ * your Api implementations
13+ */
14+ apiImplementations: ApiImplementations,
15+ /**
16+ * additional Providers that may be used by your implementations
17+ */
18+ providers?: Provider[],
19+ }
20+
1021@Module({ } )
1122export class ApiModule {
12- static forRoot(apiImplementations: ApiImplementations ): DynamicModule {
23+ static forRoot(configuration: ApiModuleConfiguration ): DynamicModule {
1324 const providers: Provider[] = [
1425{{#apiInfo} }
1526{ {#apis} }
1627 {
1728 provide: {{classname} },
18- useClass: apiImplementations.{ {#lambda.camelcase} }{ {classname} }{ {/lambda.camelcase} }
29+ useClass: configuration. apiImplementations.{ {#lambda.camelcase} }{ {classname} }{ {/lambda.camelcase} }
1930 },
2031{ {/apis} }
2132{ {/apiInfo} }
33+ ...(configuration.providers || []),
2234 ];
2335
2436 return {
Original file line number Diff line number Diff line change @@ -7,22 +7,34 @@ import { StoreApiController } from './controllers';
77import { UserApi } from './api' ;
88import { UserApiController } from './controllers' ;
99
10+ export type ApiModuleConfiguration = {
11+ /**
12+ * your Api implementations
13+ */
14+ apiImplementations : ApiImplementations ,
15+ /**
16+ * additional Providers that may be used by your implementations
17+ */
18+ providers ?: Provider [ ] ,
19+ }
20+
1021@Module ( { } )
1122export class ApiModule {
12- static forRoot ( apiImplementations : ApiImplementations ) : DynamicModule {
23+ static forRoot ( configuration : ApiModuleConfiguration ) : DynamicModule {
1324 const providers : Provider [ ] = [
1425 {
1526 provide : PetApi ,
16- useClass : apiImplementations . petApi
27+ useClass : configuration . apiImplementations . petApi
1728 } ,
1829 {
1930 provide : StoreApi ,
20- useClass : apiImplementations . storeApi
31+ useClass : configuration . apiImplementations . storeApi
2132 } ,
2233 {
2334 provide : UserApi ,
24- useClass : apiImplementations . userApi
35+ useClass : configuration . apiImplementations . userApi
2536 } ,
37+ ...( configuration . providers || [ ] ) ,
2638 ] ;
2739
2840 return {
You can’t perform that action at this time.
0 commit comments