Skip to content

Commit

Permalink
chore: move metadata loading to a separate function
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Jun 6, 2023
1 parent bf4a27e commit d74c391
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/swagger-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ export class SwaggerModule {
config: Omit<OpenAPIObject, 'paths'>,
options: SwaggerDocumentOptions = {}
): OpenAPIObject {
if (options.metadata) {
this.metadataLoader.load(options.metadata);
}
const swaggerScanner = new SwaggerScanner();
const document = swaggerScanner.scanApplication(app, options);

Expand All @@ -49,6 +46,10 @@ export class SwaggerModule {
};
}

public static async load(metadata: Record<string, any>) {
return this.metadataLoader.load(metadata);
}

private static serveStatic(finalPath: string, app: INestApplication) {
const httpAdapter = app.getHttpAdapter();
const swaggerAssetsAbsoluteFSPath = getSwaggerAssetsAbsoluteFSPath();
Expand Down

0 comments on commit d74c391

Please sign in to comment.