UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

100 lines (57 loc) 1.73 kB
--- 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) &gt; [@loopback/openapi-v3](./openapi-v3.md) &gt; [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. **Signature:** ```typescript export declare function getModelSchemaRef<T extends object>(modelCtor: Function & { prototype: T; }, options?: JsonSchemaOptions<T>): SchemaRef; ``` ## 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 &amp; { 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)<!-- -->&lt;T&gt; </td><td markdown="1"> _(Optional)_ Additional options </td></tr> </tbody></table> **Returns:** [SchemaRef](./openapi-v3.schemaref.md) ## Example ```ts const schema = { $ref: '#/components/schemas/Product', definitions: { Product: { title: 'Product', properties: { // etc. } } } } ```