UNPKG

1.16 kBTypeScriptView Raw
1import { RootSchemaTreeNode } from './schema-tree';
2import { JsonSchemaErrorBase } from './error';
3import './mimetypes';
4export declare class InvalidJsonPath extends JsonSchemaErrorBase {
5}
6/** The interface the SchemaClassFactory returned class implements. */
7export interface SchemaClass<JsonType> extends Object {
8 $$root(): JsonType;
9 $$get(path: string): any;
10 $$set(path: string, value: any): void;
11 $$alias(source: string, destination: string): boolean;
12 $$dispose(): void;
13 $$typeOf(path: string): string;
14 $$defined(path: string): boolean;
15 $$delete(path: string): void;
16 $$schema(): RootSchemaTreeNode;
17 $$serialize(mimetype?: string, ...args: any[]): string;
18}
19export interface SchemaClassFactoryReturn<T> {
20 new (value: T, ...fallbacks: T[]): SchemaClass<T>;
21}
22/**
23 * Create a class from a JSON SCHEMA object. Instanciating that class with an object
24 * allows for extended behaviour.
25 * This is the base API to access the Configuration in the CLI.
26 * @param schema
27 * @returns {GeneratedSchemaClass}
28 * @constructor
29 */
30export declare function SchemaClassFactory<T>(schema: Object): SchemaClassFactoryReturn<T>;