Page Contents
Home > @loopback/repository-json-schema > modelToJsonSchema
modelToJsonSchema() function
Converts a TypeScript class into a JSON Schema using TypeScript’s reflection API
Signature:
export declare function modelToJsonSchema<T extends object>(ctor: Function & {
prototype: T;
}, jsonSchemaOptions?: JsonSchemaOptions<T>): JsonSchema;
Parameters
Parameter | Type | Description |
---|---|---|
ctor | Function & { prototype: T; } | Constructor of class to convert from |
jsonSchemaOptions | JsonSchemaOptions<T> | (Optional) |
Returns:
JsonSchema