# Class SwaggerService

Class
Module
import { SwaggerService } from "@tsed/swagger"
Source/packages/swagger/src/services/SwaggerService.ts

# Overview

class SwaggerService {
<span class="token keyword">constructor</span><span class="token punctuation">(</span>injectorService<span class="token punctuation">:</span> <a href="/api/di/services/InjectorService.html"><span class="token">InjectorService</span></a><span class="token punctuation">,</span> platform<span class="token punctuation">:</span> <a href="/api/common/platform/services/Platform.html"><span class="token">Platform</span></a><span class="token punctuation">,</span> configuration<span class="token punctuation">:</span> <a href="/api/di/decorators/Configuration.html"><span class="token">Configuration</span></a><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token function">getOpenAPISpec</span><span class="token punctuation">(</span>conf<span class="token punctuation">:</span> <a href="/api/swagger/interfaces/SwaggerOS3Settings.html"><span class="token">SwaggerOS3Settings</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/openspec/openspec3/OpenSpec3.html"><span class="token">OpenSpec3</span></a><span class="token punctuation">;</span>
<span class="token function">getOpenAPISpec</span><span class="token punctuation">(</span>conf<span class="token punctuation">:</span> <a href="/api/swagger/interfaces/SwaggerOS2Settings.html"><span class="token">SwaggerOS2Settings</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/openspec/openspec2/OpenSpec2.html"><span class="token">OpenSpec2</span></a><span class="token punctuation">;</span>
<span class="token function">getOpenAPISpec</span><span class="token punctuation">(</span>conf<span class="token punctuation">:</span> <a href="/api/swagger/interfaces/SwaggerSettings.html"><span class="token">SwaggerSettings</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/openspec/openspec2/OpenSpec2.html"><span class="token">OpenSpec2</span></a><span class="token punctuation">;</span>

<span class="token keyword">protected</span> <span class="token function">getDefaultSpec</span><span class="token punctuation">(</span>conf<span class="token punctuation">:</span> Partial&lt;<a href="/api/swagger/interfaces/SwaggerSettings.html"><span class="token">SwaggerSettings</span></a>&gt;<span class="token punctuation">)</span><span class="token punctuation">:</span> Partial&lt;<a href="/api/openspec/openspec2/OpenSpec2.html"><span class="token">OpenSpec2</span></a> | <a href="/api/openspec/openspec3/OpenSpec3.html"><span class="token">OpenSpec3</span></a>&gt;<span class="token punctuation">;</span>
<span class="token keyword">protected</span> <span class="token function">readSpecPath</span><span class="token punctuation">(</span>path<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>

<span class="token keyword">protected</span> <span class="token function">buildRoutes</span><span class="token punctuation">(</span>ctrl<span class="token punctuation">:</span> <a href="/api/common/platform/domain/ControllerProvider.html"><span class="token">ControllerProvider</span></a><span class="token punctuation">,</span> options<span class="token punctuation">:</span> <a href="/api/schema/utils/SpecSerializerOptions.html"><span class="token">SpecSerializerOptions</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> Partial&lt;<a href="/api/openspec/openspec2/OpenSpec2.html"><span class="token">OpenSpec2</span></a>&gt;<span class="token punctuation">;</span>

}

# Members

getOpenAPISpec(conf: SwaggerOS3Settings): OpenSpec3;

Generate Spec for the given configuration


getOpenAPISpec(conf: SwaggerOS2Settings): OpenSpec2;

getOpenAPISpec(conf: SwaggerSettings): OpenSpec2;

protected getDefaultSpec(conf: Partial<SwaggerSettings>): Partial<OpenSpec2 | OpenSpec3>;

Return the global api information.


protected readSpecPath(path: string): any;

protected buildRoutes(ctrl: ControllerProvider, options: SpecSerializerOptions): Partial<OpenSpec2>;

Other topics