Skip to content

Commit

Permalink
chore: address breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Jun 15, 2023
1 parent a40fa55 commit 0e9f187
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/swagger-scanner.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { INestApplication, Type } from '@nestjs/common';
import { INestApplication, InjectionToken, Type } from '@nestjs/common';
import { MODULE_PATH } from '@nestjs/common/constants';
import { ApplicationConfig, NestContainer } from '@nestjs/core';
import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper';
import { InstanceToken, Module } from '@nestjs/core/injector/module';
import { Module } from '@nestjs/core/injector/module';
import { flatten, isEmpty } from 'lodash';
import { OpenAPIObject, SwaggerDocumentOptions } from './interfaces';
import { ModuleRoute } from './interfaces/module-route.interface';
Expand Down Expand Up @@ -50,24 +50,24 @@ export class SwaggerScanner {
: '';

const denormalizedPaths = modules.map(
({ routes, metatype, relatedModules }) => {
({ controllers, metatype, imports }) => {
let result: ModuleRoute[] = [];

if (deepScanRoutes) {
// only load submodules routes if asked
// Only load submodules routes if explicitly enabled
const isGlobal = (module: Type<any>) =>
!container.isGlobalModule(module);

Array.from(relatedModules.values())
Array.from(imports.values())
.filter(isGlobal as any)
.forEach(({ metatype, routes }) => {
.forEach(({ metatype, controllers }) => {
const modulePath = this.getModulePathMetadata(
container,
metatype
);
result = result.concat(
this.scanModuleRoutes(
routes,
this.scanModuleControllers(
controllers,
modulePath,
globalPrefix,
internalConfigRef,
Expand All @@ -78,8 +78,8 @@ export class SwaggerScanner {
}
const modulePath = this.getModulePathMetadata(container, metatype);
result = result.concat(
this.scanModuleRoutes(
routes,
this.scanModuleControllers(
controllers,
modulePath,
globalPrefix,
internalConfigRef,
Expand All @@ -101,14 +101,14 @@ export class SwaggerScanner {
};
}

public scanModuleRoutes(
routes: Map<InstanceToken, InstanceWrapper>,
public scanModuleControllers(
controller: Map<InjectionToken, InstanceWrapper>,
modulePath: string | undefined,
globalPrefix: string | undefined,
applicationConfig: ApplicationConfig,
operationIdFactory?: (controllerKey: string, methodKey: string) => string
): ModuleRoute[] {
const denormalizedArray = [...routes.values()].map((ctrl) =>
const denormalizedArray = [...controller.values()].map((ctrl) =>
this.explorer.exploreController(
ctrl,
applicationConfig,
Expand Down

0 comments on commit 0e9f187

Please sign in to comment.