1 | import type { AnySchema, AnySchemaObject, AnyValidateFunction, EvaluatedProperties, EvaluatedItems } from "../types";
|
---|
2 | import type Ajv from "../core";
|
---|
3 | import type { InstanceOptions } from "../core";
|
---|
4 | import { CodeGen, Name, Code, ValueScopeName } from "./codegen";
|
---|
5 | import { LocalRefs } from "./resolve";
|
---|
6 | import { JSONType } from "./rules";
|
---|
7 | export declare type SchemaRefs = {
|
---|
8 | [Ref in string]?: SchemaEnv | AnySchema;
|
---|
9 | };
|
---|
10 | export interface SchemaCxt {
|
---|
11 | readonly gen: CodeGen;
|
---|
12 | readonly allErrors?: boolean;
|
---|
13 | readonly data: Name;
|
---|
14 | readonly parentData: Name;
|
---|
15 | readonly parentDataProperty: Code | number;
|
---|
16 | readonly dataNames: Name[];
|
---|
17 | readonly dataPathArr: (Code | number)[];
|
---|
18 | readonly dataLevel: number;
|
---|
19 | dataTypes: JSONType[];
|
---|
20 | definedProperties: Set<string>;
|
---|
21 | readonly topSchemaRef: Code;
|
---|
22 | readonly validateName: Name;
|
---|
23 | evaluated?: Name;
|
---|
24 | readonly ValidationError?: Name;
|
---|
25 | readonly schema: AnySchema;
|
---|
26 | readonly schemaEnv: SchemaEnv;
|
---|
27 | readonly rootId: string;
|
---|
28 | baseId: string;
|
---|
29 | readonly schemaPath: Code;
|
---|
30 | readonly errSchemaPath: string;
|
---|
31 | readonly errorPath: Code;
|
---|
32 | readonly propertyName?: Name;
|
---|
33 | readonly compositeRule?: boolean;
|
---|
34 | props?: EvaluatedProperties | Name;
|
---|
35 | items?: EvaluatedItems | Name;
|
---|
36 | jtdDiscriminator?: string;
|
---|
37 | jtdMetadata?: boolean;
|
---|
38 | readonly createErrors?: boolean;
|
---|
39 | readonly opts: InstanceOptions;
|
---|
40 | readonly self: Ajv;
|
---|
41 | }
|
---|
42 | export interface SchemaObjCxt extends SchemaCxt {
|
---|
43 | readonly schema: AnySchemaObject;
|
---|
44 | }
|
---|
45 | interface SchemaEnvArgs {
|
---|
46 | readonly schema: AnySchema;
|
---|
47 | readonly schemaId?: "$id" | "id";
|
---|
48 | readonly root?: SchemaEnv;
|
---|
49 | readonly baseId?: string;
|
---|
50 | readonly schemaPath?: string;
|
---|
51 | readonly localRefs?: LocalRefs;
|
---|
52 | readonly meta?: boolean;
|
---|
53 | }
|
---|
54 | export declare class SchemaEnv implements SchemaEnvArgs {
|
---|
55 | readonly schema: AnySchema;
|
---|
56 | readonly schemaId?: "$id" | "id";
|
---|
57 | readonly root: SchemaEnv;
|
---|
58 | baseId: string;
|
---|
59 | schemaPath?: string;
|
---|
60 | localRefs?: LocalRefs;
|
---|
61 | readonly meta?: boolean;
|
---|
62 | readonly $async?: boolean;
|
---|
63 | readonly refs: SchemaRefs;
|
---|
64 | readonly dynamicAnchors: {
|
---|
65 | [Ref in string]?: true;
|
---|
66 | };
|
---|
67 | validate?: AnyValidateFunction;
|
---|
68 | validateName?: ValueScopeName;
|
---|
69 | serialize?: (data: unknown) => string;
|
---|
70 | serializeName?: ValueScopeName;
|
---|
71 | parse?: (data: string) => unknown;
|
---|
72 | parseName?: ValueScopeName;
|
---|
73 | constructor(env: SchemaEnvArgs);
|
---|
74 | }
|
---|
75 | export declare function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv;
|
---|
76 | export declare function resolveRef(this: Ajv, root: SchemaEnv, baseId: string, ref: string): AnySchema | SchemaEnv | undefined;
|
---|
77 | export declare function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void;
|
---|
78 | export declare function resolveSchema(this: Ajv, root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it
|
---|
79 | ref: string): SchemaEnv | undefined;
|
---|
80 | export {};
|
---|