MCPcopy
hub / github.com/nestjs/swagger / exploreController

Method exploreController

lib/swagger-explorer.ts:104–156  ·  view source on GitHub ↗
(
    wrapper: InstanceWrapper<Controller>,
    applicationConfig: ApplicationConfig,
    options: {
      modulePath?: string;
      globalPrefix?: string;
      operationIdFactory?: OperationIdFactory;
      linkNameFactory?: (
        controllerKey: string,
        methodKey: string,
        fieldKey: string
      ) => string;
      autoTagControllers?: boolean;
      onlyIncludeDecoratedEndpoints?: boolean;
    }
  )

Source from the content-addressed store, hash-verified

102 ) {}
103
104 public exploreController(
105 wrapper: InstanceWrapper<Controller>,
106 applicationConfig: ApplicationConfig,
107 options: {
108 modulePath?: string;
109 globalPrefix?: string;
110 operationIdFactory?: OperationIdFactory;
111 linkNameFactory?: (
112 controllerKey: string,
113 methodKey: string,
114 fieldKey: string
115 ) => string;
116 autoTagControllers?: boolean;
117 onlyIncludeDecoratedEndpoints?: boolean;
118 }
119 ) {
120 const { operationIdFactory, linkNameFactory } = options;
121
122 this.routePathFactory = new RoutePathFactory(applicationConfig);
123 if (operationIdFactory) {
124 this.operationIdFactory = operationIdFactory;
125 }
126
127 if (linkNameFactory) {
128 this.linkNameFactory = linkNameFactory;
129 }
130 const { instance, metatype } = wrapper;
131 const prototype = Object.getPrototypeOf(instance);
132 const documentResolvers: DenormalizedDocResolvers = {
133 root: [
134 this.exploreRoutePathAndMethod,
135 exploreApiOperationMetadata,
136 exploreApiParametersMetadata.bind(null, this.schemas)
137 ],
138 security: [exploreApiSecurityMetadata],
139 tags: [exploreApiTagsMetadata],
140 callbacks: [exploreApiCallbacksMetadata],
141 responses: [
142 exploreApiResponseMetadata.bind(null, this.schemas, {
143 operationId: this.operationIdFactory,
144 linkName: this.linkNameFactory
145 })
146 ]
147 };
148 return this.generateDenormalizedDocument(
149 metatype as Type<unknown>,
150 prototype,
151 instance,
152 documentResolvers,
153 applicationConfig,
154 options
155 );
156 }
157
158 public getSchemas(): Record<string, SchemaObject> {
159 return this.schemas;

Callers 2

scanModuleControllersMethod · 0.80

Calls 1

Tested by

no test coverage detected