@jtdc/jtd-dialect
Version:
JTD dialect for JTDc.
28 lines (27 loc) • 2.22 kB
TypeScript
import { IValidationContext } from './runtime-types';
export * from './runtime-types';
export { JSON_POINTER_SEPARATOR as _S, toJsonPointer as _P, getObjectKeys as _K, raiseInvalid as _R, checkObject as _o, checkArray as _a, checkEnum as _e, checkBoolean as _b, checkString as _s, checkNumber as _n, checkInteger as _i, isNotNullable as _N, isNotOptional as _O, };
export declare const JSON_POINTER_SEPARATOR = "/";
export declare function isNotNullable(value: unknown): boolean;
export declare function isNotOptional(value: unknown): boolean;
export declare function getObjectKeys(value: object): Array<string>;
/**
* Returns `true` if further validation must be prevented.
*/
export declare function isValidationCompleted(ctx: IValidationContext): boolean;
export declare function toJsonPointer(str: string | number): string;
export declare function raiseValidationError(code: string | number, ctx: IValidationContext, pointer: string): false;
export declare function raiseIllegalType(ctx: IValidationContext, pointer: string): false;
export declare function raiseInvalid(ctx: IValidationContext, pointer: string): false;
/**
* Returns `false` if value is excluded from validation.
*/
export declare function rejectExcluded(value: unknown, ctx: IValidationContext): boolean;
export declare function checkRequired(value: unknown, ctx: IValidationContext, pointer: string): value is {};
export declare function checkArray(value: unknown, ctx: IValidationContext, pointer: string): value is Array<unknown>;
export declare function checkObject(value: unknown, ctx: IValidationContext, pointer: string): value is Record<string, unknown>;
export declare function checkString(value: unknown, ctx: IValidationContext, pointer: string): value is string;
export declare function checkNumber(value: unknown, ctx: IValidationContext, pointer: string): value is number;
export declare function checkInteger(value: unknown, ctx: IValidationContext, pointer: string): value is number;
export declare function checkBoolean(value: unknown, ctx: IValidationContext, pointer: string): value is boolean;
export declare function checkEnum(value: unknown, values: Array<string>, ctx: IValidationContext, pointer: string): value is string;