UNPKG

1.72 kBTypeScriptView Raw
1import type { AnySchema } from "../../types";
2import type { SchemaObjCxt } from "..";
3import { Code, Name } from "../codegen";
4import { Type } from "../util";
5import type { JSONType } from "../rules";
6export interface SubschemaContext {
7 schema: AnySchema;
8 schemaPath: Code;
9 errSchemaPath: string;
10 topSchemaRef?: Code;
11 errorPath?: Code;
12 dataLevel?: number;
13 dataTypes?: JSONType[];
14 data?: Name;
15 parentData?: Name;
16 parentDataProperty?: Code | number;
17 dataNames?: Name[];
18 dataPathArr?: (Code | number)[];
19 propertyName?: Name;
20 jtdDiscriminator?: string;
21 jtdMetadata?: boolean;
22 compositeRule?: true;
23 createErrors?: boolean;
24 allErrors?: boolean;
25}
26export type SubschemaArgs = Partial<{
27 keyword: string;
28 schemaProp: string | number;
29 schema: AnySchema;
30 schemaPath: Code;
31 errSchemaPath: string;
32 topSchemaRef: Code;
33 data: Name | Code;
34 dataProp: Code | string | number;
35 dataTypes: JSONType[];
36 definedProperties: Set<string>;
37 propertyName: Name;
38 dataPropType: Type;
39 jtdDiscriminator: string;
40 jtdMetadata: boolean;
41 compositeRule: true;
42 createErrors: boolean;
43 allErrors: boolean;
44}>;
45export declare function getSubschema(it: SchemaObjCxt, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }: SubschemaArgs): SubschemaContext;
46export declare function extendSubschemaData(subschema: SubschemaContext, it: SchemaObjCxt, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }: SubschemaArgs): void;
47export declare function extendSubschemaMode(subschema: SubschemaContext, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }: SubschemaArgs): void;