@goatlab/fluent
Version:
Readable query Interface & API generator for TS and Node
32 lines (31 loc) • 1.5 kB
TypeScript
import { MetadataAccessor } from '@loopback/metadata';
import { SchemaObject as JsonSchema } from 'openapi3-ts';
import { RelationMetadata } from './relation.types';
import { PropertyDefinition, PropertyType } from './model';
export declare const JSON_SCHEMA_KEY: MetadataAccessor<{
[key: string]: JsonSchema;
}, ClassDecorator>;
export interface JsonSchemaOptions<T extends object> {
title?: string;
includeRelations?: boolean;
partial?: boolean | 'deep';
exclude?: (keyof T)[];
optional?: (keyof T)[];
visited?: {
[key: string]: JsonSchema;
};
}
export declare function buildModelCacheKey<T extends object>(options?: JsonSchemaOptions<T>): string;
export declare function getJsonSchema<T extends object>(ctor: Function & {
prototype: T;
}, options?: JsonSchemaOptions<T>): JsonSchema;
export declare function getJsonSchemaRef<T extends object>(modelCtor: Function & {
prototype: T;
}, options?: JsonSchemaOptions<T>): JsonSchema;
export declare function stringTypeToWrapper(type: string | Function): Function;
export declare function isArrayType(type: string | Function | PropertyType): boolean;
export declare function metaToJsonProperty(meta: PropertyDefinition): JsonSchema;
export declare function getNavigationalPropertyForRelation(relMeta: RelationMetadata, targetRef: JsonSchema): JsonSchema;
export declare function modelToJsonSchema<T extends object>(ctor: Function & {
prototype: T;
}, jsonSchemaOptions?: JsonSchemaOptions<T>): JsonSchema;