Page Contents
Home > @loopback/repository-json-schema > getJsonSchemaRef
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:
export declare function getJsonSchemaRef<T extends object>(modelCtor: Function & {
prototype: T;
}, options?: JsonSchemaOptions<T>): JsonSchema;
Parameters
Parameter | Type | Description |
---|---|---|
modelCtor | Function & { prototype: T; } | The model constructor (e.g. Product ) |
options | JsonSchemaOptions<T> | (Optional) Additional options |
Returns:
JsonSchema
Example
const schema = {
$ref: '/definitions/Product',
definitions: {
Product: {
title: 'Product',
properties: {
// etc.
}
}
}
}