@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
100 lines (57 loc) • 1.76 kB
Markdown
---
lang: en
title: 'API docs: repository-json-schema.getjsonschemaref'
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.getjsonschemaref.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/repository-json-schema](./repository-json-schema.md) > [getJsonSchemaRef](./repository-json-schema.getjsonschemaref.md)
## getJsonSchemaRef() function
Describe the provided Model as a reference to a definition shared by multiple endpoints. The definition is included in the returned schema.
**Signature:**
```typescript
export declare function getJsonSchemaRef<T extends object>(modelCtor: 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">
modelCtor
</td><td markdown="1">
Function & { prototype: T; }
</td><td markdown="1">
The model constructor (e.g. `Product`<!-- -->)
</td></tr>
<tr><td markdown="1">
options
</td><td markdown="1">
[JsonSchemaOptions](./repository-json-schema.jsonschemaoptions.md)<!-- --><T>
</td><td markdown="1">
_(Optional)_ Additional options
</td></tr>
</tbody></table>
**Returns:**
JsonSchema
## Example
```ts
const schema = {
$ref: '/definitions/Product',
definitions: {
Product: {
title: 'Product',
properties: {
// etc.
}
}
}
}
```