Page Contents

Home > @loopback/repository-json-schema > getJsonSchema

getJsonSchema() function

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.

Signature:

export declare function getJsonSchema<T extends object>(ctor: Function & {
    prototype: T;
}, options?: JsonSchemaOptions<T>): JsonSchema;

Parameters

Parameter Type Description
ctor Function & { prototype: T; } Constructor of class to get JSON Schema from
options JsonSchemaOptions<T> (Optional)

Returns:

JsonSchema