diff --git a/lib/swagger-module.ts b/lib/swagger-module.ts index 6b34e05e5..6bd4ebddd 100644 --- a/lib/swagger-module.ts +++ b/lib/swagger-module.ts @@ -29,9 +29,6 @@ export class SwaggerModule { config: Omit, options: SwaggerDocumentOptions = {} ): OpenAPIObject { - if (options.metadata) { - this.metadataLoader.load(options.metadata); - } const swaggerScanner = new SwaggerScanner(); const document = swaggerScanner.scanApplication(app, options); @@ -49,6 +46,10 @@ export class SwaggerModule { }; } + public static async load(metadata: Record) { + return this.metadataLoader.load(metadata); + } + private static serveStatic(finalPath: string, app: INestApplication) { const httpAdapter = app.getHttpAdapter(); const swaggerAssetsAbsoluteFSPath = getSwaggerAssetsAbsoluteFSPath();