---
lang: en
title: 'API docs: repository-json-schema'
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.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)

## repository-json-schema package

Convert a TypeScript class/model to a JSON Schema for users, leveraging LoopBack4's decorators, metadata, and reflection system.

## Remarks

Modules to easily convert LoopBack4 models that have been decorated with `@model` and `@property` to a matching JSON Schema Definition.

## Functions

<table><thead><tr><th>

Function


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[getFieldsJsonSchemaFor(modelCtor, options)](./repository-json-schema.getfieldsjsonschemafor.md)


</td><td>

Build a JSON schema describing the format of the "fields" object used to include or exclude properties of model instances.


</td></tr>
<tr><td>

[getFilterJsonSchemaFor(modelCtor, options)](./repository-json-schema.getfilterjsonschemafor.md)


</td><td>

Build a JSON schema describing the format of the "filter" object used to query model instances.

Note we don't take the model properties into account yet and return a generic json schema allowing any "where" condition.


</td></tr>
<tr><td>

[getJsonSchema(ctor, options)](./repository-json-schema.getjsonschema.md)


</td><td>

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.


</td></tr>
<tr><td>

[getJsonSchemaRef(modelCtor, options)](./repository-json-schema.getjsonschemaref.md)


</td><td>

Describe the provided Model as a reference to a definition shared by multiple endpoints. The definition is included in the returned schema.


</td></tr>
<tr><td>

[getNavigationalPropertyForRelation(relMeta, targetRef)](./repository-json-schema.getnavigationalpropertyforrelation.md)


</td><td>

Checks and return navigational property definition for the relation


</td></tr>
<tr><td>

[getScopeFilterJsonSchemaFor(modelCtor, options)](./repository-json-schema.getscopefilterjsonschemafor.md)


</td><td>

Build a JSON schema describing the format of the "scope" object used to query model instances.

Note we don't take the model properties into account yet and return a generic json schema allowing any "where" condition.


</td></tr>
<tr><td>

[getWhereJsonSchemaFor(modelCtor, options)](./repository-json-schema.getwherejsonschemafor.md)


</td><td>

Build a JSON schema describing the format of the "where" object used to filter model instances to query, update or delete.

Note we don't take the model properties into account yet and return a generic json schema allowing any "where" condition.


</td></tr>
<tr><td>

[isArrayType(type)](./repository-json-schema.isarraytype.md)


</td><td>

Determines whether a given string or constructor is array type or not


</td></tr>
<tr><td>

[metaToJsonProperty(meta)](./repository-json-schema.metatojsonproperty.md)


</td><td>

Converts property metadata into a JSON property definition


</td></tr>
<tr><td>

[modelToJsonSchema(ctor, jsonSchemaOptions)](./repository-json-schema.modeltojsonschema.md)


</td><td>

Converts a TypeScript class into a JSON Schema using TypeScript's reflection API


</td></tr>
<tr><td>

[stringTypeToWrapper(type)](./repository-json-schema.stringtypetowrapper.md)


</td><td>

Gets the wrapper function of primitives string, number, and boolean


</td></tr>
</tbody></table>

## Interfaces

<table><thead><tr><th>

Interface


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[FilterSchemaOptions](./repository-json-schema.filterschemaoptions.md)


</td><td>


</td></tr>
<tr><td>

[JsonSchemaOptions](./repository-json-schema.jsonschemaoptions.md)


</td><td>


</td></tr>
</tbody></table>

## Variables

<table><thead><tr><th>

Variable


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[AnyScopeFilterSchema](./repository-json-schema.anyscopefilterschema.md)


</td><td>


</td></tr>
<tr><td>

[JSON\_SCHEMA\_KEY](./repository-json-schema.json_schema_key.md)


</td><td>

Metadata key used to set or retrieve repository JSON Schema


</td></tr>
</tbody></table>

## Type Aliases

<table><thead><tr><th>

Type Alias


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[Optional](./repository-json-schema.optional.md)


</td><td>

Optional: From `T` make a set of properties by key `K` become optional


</td></tr>
</tbody></table>

