---
lang: en
title: 'API docs: repository-json-schema.getjsonschema'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/repository-json-schema
permalink: /doc/en/lb4/apidocs.repository-json-schema.getjsonschema.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/repository-json-schema](./repository-json-schema.md) &gt; [getJsonSchema](./repository-json-schema.getjsonschema.md)

## getJsonSchema() function

Gets the JSON Schema of a TypeScript model/class by seeing if one exists in a cache. If not, one is generated and then cached.

**Signature:**

```typescript
export declare function getJsonSchema<T extends object>(ctor: Function & {
    prototype: T;
}, options?: JsonSchemaOptions<T>): JsonSchema;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td markdown="1">

ctor


</td><td markdown="1">

Function &amp; { prototype: T; }


</td><td markdown="1">

Constructor of class to get JSON Schema from


</td></tr>
<tr><td markdown="1">

options


</td><td markdown="1">

[JsonSchemaOptions](./repository-json-schema.jsonschemaoptions.md)<!-- -->&lt;T&gt;


</td><td markdown="1">

_(Optional)_


</td></tr>
</tbody></table>

**Returns:**

JsonSchema


