jsonv-ts
Version:
JSON Schema builder and validator for TypeScript with static type inference, Hono middleware for OpenAPI generation and validation, and MCP server/client implementation. Lightweight, dependency-free, and built on Web Standards.
23 lines (22 loc) • 787 B
TypeScript
import type { Schema } from "../schema/schema";
import type { ErrorDetail } from "../utils/details";
import { Resolver } from "./resolver";
type TKeywordFn = (schema: object, value: unknown, opts: Omit<ValidationOptions, "coerce">) => ValidationResult;
export declare const keywords: Record<string, TKeywordFn>;
export type ValidationOptions = {
keywordPath?: string[];
instancePath?: string[];
coerce?: boolean;
errors?: ErrorDetail[];
shortCircuit?: boolean;
ignoreUnsupported?: boolean;
resolver?: Resolver;
depth?: number;
skipClone?: boolean;
};
export type ValidationResult = {
valid: boolean;
errors: ErrorDetail[];
};
export declare function validate(s: Schema, _value: unknown, opts?: ValidationOptions): ValidationResult;
export {};