flowjv
Version:
Flow based approach to JSON validation!
21 lines (20 loc) • 1.64 kB
TypeScript
import { IFlowConfig, IPayload, IValidationResult } from "../helper";
import { IKeyPath } from "../../../helper/immutable";
import { ISimpleType } from "../simple";
import { IIfConditionType } from "../logic/if";
import { ISwitchType } from "../logic/switch";
import { IArrayType } from "./array";
export declare type IObjectCondition<IData = {}, IContext = {}, A = {}, B = {}, C = {}, D = {}, E = {}, F = {}> = IIfConditionType<IData, IContext, A, B, C, D, E, F> | ISwitchType<IData, IContext, A, B, C, D, E, F>;
export declare type IObjectProperty<IData = {}, IContext = {}, A = {}, B = {}, C = {}, D = {}, E = {}, F = {}> = (ISimpleType<IData, IContext, A, B, C, D, E> | IObjectType<IData, IContext, A, B, C, D, E, F> | IArrayType<IData, IContext, A, B, C, D, E, F>) & {
key: string;
};
export declare type IObjectPropertyAndCondition<IData = {}, IContext = {}, A = {}, B = {}, C = {}, D = {}, E = {}, F = {}> = IObjectCondition<IData, IContext, A, B, C, D, E> | IObjectProperty<IData, IContext, A, B, C, D, E>;
export declare type IObjectType<IData = {}, IContext = {}, A = {}, B = {}, C = {}, D = {}, E = {}, F = {}> = {
type: "object";
properties: (IObjectProperty<IData, IContext, A, B, C, D, E, F> | IObjectCondition<IData, IContext, A, B, C, D, E, F>)[];
};
export declare type IObjectPayload = IPayload & {
refPath: IKeyPath;
};
export declare function validateObjectType(schema: IObjectType, payload: IObjectPayload, config: IFlowConfig): IValidationResult;
export declare function validateObjectProperties(properties: IObjectType["properties"], payload: IObjectPayload, config: IFlowConfig): IValidationResult;