1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import { ValidateFunction } from 'ajv';
|
9 | import { Observable } from 'rxjs';
|
10 | import { BaseException } from '../../exception';
|
11 | import { JsonObject } from '../utils';
|
12 | import { JsonVisitor, PromptProvider, SchemaFormat, SchemaRegistry, SchemaValidator, SchemaValidatorError, SmartDefaultProvider } from './interface';
|
13 | import { JsonSchema } from './schema';
|
14 | export type UriHandler = (uri: string) => Observable<JsonObject> | Promise<JsonObject> | null | undefined;
|
15 | export declare class SchemaValidationException extends BaseException {
|
16 | readonly errors: SchemaValidatorError[];
|
17 | constructor(errors?: SchemaValidatorError[], baseMessage?: string);
|
18 | static createMessages(errors?: SchemaValidatorError[]): string[];
|
19 | }
|
20 | export declare class CoreSchemaRegistry implements SchemaRegistry {
|
21 | private _ajv;
|
22 | private _uriCache;
|
23 | private _uriHandlers;
|
24 | private _pre;
|
25 | private _post;
|
26 | private _currentCompilationSchemaInfo?;
|
27 | private _smartDefaultKeyword;
|
28 | private _promptProvider?;
|
29 | private _sourceMap;
|
30 | constructor(formats?: SchemaFormat[]);
|
31 | private _fetch;
|
32 | /**
|
33 | * Add a transformation step before the validation of any Json.
|
34 | * @param {JsonVisitor} visitor The visitor to transform every value.
|
35 | * @param {JsonVisitor[]} deps A list of other visitors to run before.
|
36 | */
|
37 | addPreTransform(visitor: JsonVisitor, deps?: JsonVisitor[]): void;
|
38 | |
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | addPostTransform(visitor: JsonVisitor, deps?: JsonVisitor[]): void;
|
46 | protected _resolver(ref: string, validate?: ValidateFunction): {
|
47 | context?: ValidateFunction;
|
48 | schema?: JsonObject;
|
49 | };
|
50 | |
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | ɵflatten(schema: JsonObject): Promise<JsonObject>;
|
62 | |
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | compile(schema: JsonSchema): Promise<SchemaValidator>;
|
69 | private _compile;
|
70 | addFormat(format: SchemaFormat): void;
|
71 | addSmartDefaultProvider<T>(source: string, provider: SmartDefaultProvider<T>): void;
|
72 | registerUriHandler(handler: UriHandler): void;
|
73 | usePromptProvider(provider: PromptProvider): void;
|
74 | private _applyPrompts;
|
75 | private static _set;
|
76 | private _applySmartDefaults;
|
77 | useXDeprecatedProvider(onUsage: (message: string) => void): void;
|
78 | private normalizeDataPathArr;
|
79 | }
|