@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
55 lines (39 loc) • 1.46 kB
Markdown
---
lang: en
title: 'API docs: openapi-v3.getmodelschemaref'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/openapi-v3
permalink: /doc/en/lb4/apidocs.openapi-v3.getmodelschemaref.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/openapi-v3](./openapi-v3.md) > [getModelSchemaRef](./openapi-v3.getmodelschemaref.md)
## getModelSchemaRef() function
Describe the provided Model as a reference to a definition shared by multiple endpoints. The definition is included in the returned schema.
<b>Signature:</b>
```typescript
export declare function getModelSchemaRef<T extends object>(modelCtor: Function & {
prototype: T;
}, options?: JsonSchemaOptions<T>): SchemaRef;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| modelCtor | Function & { prototype: T; } | The model constructor (e.g. <code>Product</code>) |
| options | [JsonSchemaOptions](./repository-json-schema.jsonschemaoptions.md)<!-- --><T> | Additional options |
<b>Returns:</b>
[SchemaRef](./openapi-v3.schemaref.md)
## Example
```ts
const schema = {
$ref: '#/components/schemas/Product',
definitions: {
Product: {
title: 'Product',
properties: {
// etc.
}
}
}
}
```