---
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

|  Function | Description |
|  --- | --- |
|  [getFieldsJsonSchemaFor(modelCtor, options)](./repository-json-schema.getfieldsjsonschemafor.md) | Build a JSON schema describing the format of the "fields" object used to include or exclude properties of model instances. |
|  [getFilterJsonSchemaFor(modelCtor, options)](./repository-json-schema.getfilterjsonschemafor.md) | 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. |
|  [getJsonSchema(ctor, options)](./repository-json-schema.getjsonschema.md) | 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. |
|  [getJsonSchemaRef(modelCtor, options)](./repository-json-schema.getjsonschemaref.md) | Describe the provided Model as a reference to a definition shared by multiple endpoints. The definition is included in the returned schema. |
|  [getNavigationalPropertyForRelation(relMeta, targetRef)](./repository-json-schema.getnavigationalpropertyforrelation.md) | Checks and return navigational property definition for the relation |
|  [getScopeFilterJsonSchemaFor(modelCtor, options)](./repository-json-schema.getscopefilterjsonschemafor.md) | 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. |
|  [getWhereJsonSchemaFor(modelCtor, options)](./repository-json-schema.getwherejsonschemafor.md) | 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. |
|  [isArrayType(type)](./repository-json-schema.isarraytype.md) | Determines whether a given string or constructor is array type or not |
|  [metaToJsonProperty(meta)](./repository-json-schema.metatojsonproperty.md) | Converts property metadata into a JSON property definition |
|  [modelToJsonSchema(ctor, jsonSchemaOptions)](./repository-json-schema.modeltojsonschema.md) | Converts a TypeScript class into a JSON Schema using TypeScript's reflection API |
|  [stringTypeToWrapper(type)](./repository-json-schema.stringtypetowrapper.md) | Gets the wrapper function of primitives string, number, and boolean |

## Interfaces

|  Interface | Description |
|  --- | --- |
|  [FilterSchemaOptions](./repository-json-schema.filterschemaoptions.md) |  |
|  [JsonSchemaOptions](./repository-json-schema.jsonschemaoptions.md) |  |

## Variables

|  Variable | Description |
|  --- | --- |
|  [AnyScopeFilterSchema](./repository-json-schema.anyscopefilterschema.md) |  |
|  [JSON\_SCHEMA\_KEY](./repository-json-schema.json_schema_key.md) | Metadata key used to set or retrieve repository JSON Schema |

## Type Aliases

|  Type Alias | Description |
|  --- | --- |
|  [Optional](./repository-json-schema.optional.md) | Optional: From <code>T</code> make a set of properties by key <code>K</code> become optional |


