# OpenApiModelSchemaBuilder Class

Module
import { OpenApiModelSchemaBuilder } from "@tsed/swagger/src/class/OpenApiModelSchemaBuilder"
Source/packages/swagger/src/class/OpenApiModelSchemaBuilder.ts

# Overview

class OpenApiModelSchemaBuilder {
<span class="token keyword">protected</span> _definitions<span class="token punctuation">:</span> <a href="/api/swagger/interfaces/OpenApiDefinitions.html"><span class="token">OpenApiDefinitions</span></a><span class="token punctuation">;</span>
<span class="token keyword">protected</span> _responses<span class="token punctuation">:</span> <a href="/api/swagger/interfaces/OpenApiResponses.html"><span class="token">OpenApiResponses</span></a><span class="token punctuation">;</span>
<span class="token keyword">protected</span> _schema<span class="token punctuation">:</span> <a href="/api/mongoose/decorators/Schema.html"><span class="token">Schema</span></a><span class="token punctuation">;</span>
<span class="token keyword">constructor</span><span class="token punctuation">(</span>target<span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">)</span><span class="token punctuation">;</span>
get <span class="token function">schema</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/mongoose/decorators/Schema.html"><span class="token">Schema</span></a><span class="token punctuation">;</span>
get <span class="token function">definitions</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/swagger/interfaces/OpenApiDefinitions.html"><span class="token">OpenApiDefinitions</span></a><span class="token punctuation">;</span>
get <span class="token function">responses</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/swagger/interfaces/OpenApiResponses.html"><span class="token">OpenApiResponses</span></a><span class="token punctuation">;</span>
/**
 * Build the <a href="/api/mongoose/decorators/Schema.html"><span class="token">Schema</span></a> and his properties.
 * @returns <span class="token punctuation">{</span>OpenApiModelSchemaBuilder<span class="token punctuation">}</span>
 */
<span class="token function">build</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> this<span class="token punctuation">;</span>
/**
 *
 * @param <span class="token punctuation">{</span><a href="/api/core/class/Storable.html"><span class="token">Storable</span></a><span class="token punctuation">}</span> model
 * @returns <span class="token punctuation">{</span><a href="/api/mongoose/decorators/Schema.html"><span class="token">Schema</span></a><span class="token punctuation">}</span>
 */
<span class="token keyword">protected</span> <span class="token function">createSchema</span><span class="token punctuation">(</span><span class="token punctuation">{</span> schema<span class="token punctuation">,</span> type<span class="token punctuation">,</span> collectionType <span class="token punctuation">}</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
    schema<span class="token punctuation">:</span> Partial&lt;<a href="/api/mongoose/decorators/Schema.html"><span class="token">Schema</span></a>&gt;<span class="token punctuation">;</span>
    type<span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>
    collectionType<span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt; | undefined<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/mongoose/decorators/Schema.html"><span class="token">Schema</span></a><span class="token punctuation">;</span>
/**
 * Return the stored <a href="/api/mongoose/decorators/Schema.html"><span class="token">Schema</span></a> of the <span class="token keyword">class</span> if exists. Otherwise<span class="token punctuation">,</span> return an empty <a href="/api/mongoose/decorators/Schema.html"><span class="token">Schema</span></a>.
 * @returns <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">getClassSchema</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/mongoose/decorators/Schema.html"><span class="token">Schema</span></a><span class="token punctuation">;</span>

} /**

  • @deprecated */

# Description

Build a Schema from a given Model.