@allgemein/schema-api
Version:
Library for schema api
50 lines (49 loc) • 2.3 kB
TypeScript
import { IJsonSchema7, IJsonSchema7Definition } from './JsonSchema7';
import { IClassRef } from '../../api/IClassRef';
import { IPropertyRef } from '../../api/IPropertyRef';
import { IJsonSchemaSerializer } from './IJsonSchemaSerializer';
import { IEntityRef } from '../../api/IEntityRef';
import { IJsonSchemaSerializeOptions } from './IJsonSchemaSerializeOptions';
import { IEntityOptions } from '../options/IEntityOptions';
import { IPropertyOptions } from '../options/IPropertyOptions';
export declare class JsonSchema7Serializer implements IJsonSchemaSerializer {
options: IJsonSchemaSerializeOptions;
data: IJsonSchema7;
current: string;
constructor(opts: IJsonSchemaSerializeOptions);
uri(): string;
private isCurrentClass;
serialize(klass: IClassRef | IEntityRef | Function | object): IJsonSchema7;
getJsonSchema(): IJsonSchema7;
private getOrCreateSchemaDefinitions;
private getOrCreateRoot;
applyRef(className: string): void;
describeEntityRef(klass: IEntityRef): IJsonSchema7;
describeClassRef(klass: IClassRef): IJsonSchema7;
private describeRef;
describeInheritedClass(root: IJsonSchema7, proto: IClassRef): void;
describeClass(klass: Function): IJsonSchema7;
appendProperties(data: any, properties: {
[k: string]: IJsonSchema7Definition;
}): void;
describePropertiesForFunction(klass: Function): {
[k: string]: IJsonSchema7Definition;
};
describePropertiesForRef(klass: IClassRef): {
[k: string]: IJsonSchema7Definition;
};
isAppendTargetSet(): boolean;
describePropertyForFunction(klass: Function | IClassRef, propertyName: string, instance?: any): IJsonSchema7Definition;
appendAdditionalOptions(propMeta: any, data: IEntityOptions | IPropertyOptions): void;
/**
* General handle to check allow options method
*
* @param entry
*/
allowed(entry: IPropertyRef | string, klass?: any): boolean;
describePropertyForRef(klass: IClassRef, property: IPropertyRef): IJsonSchema7Definition;
describeTargetRef(property: IPropertyRef, propMeta: any, mode: 'collection' | 'single'): void;
propertyPostproces(opt: IJsonSchema7): void;
getNormedType(property: IPropertyRef): string | Function;
getDefaultTypeHint(): any;
}