import { z } from "zod/v4"; import type { JSONSchema } from "zod/v4/core"; /** * A function that converts a single JSON Schema node to a Zod schema. */ export type ConvertFunction = (schema: JSONSchema.BaseSchema | boolean) => z.ZodTypeAny; /** * Keys that never constrain a value by themselves. A schema whose keys are * all in this set is treated as unconstrained (converted to z.any()); any * reference keywords it carries are enforced separately by the RefHandler. */ export declare const NON_CONSTRAINT_KEYS: ReadonlySet; /** * The result of statically analyzing a schema document for reference * resolution: per-node base URIs, embedded resource roots by canonical URI, * and anchors scoped to their containing resource. */ export interface DocumentAnalysis { baseUriByNode: WeakMap; resourcesByUri: Map; anchorsByUri: Map; } /** * Walks a schema document, assigning every schema node its base URI and * indexing embedded resources ($id) and anchors ($anchor/$dynamicAnchor). * Only positions known to hold schemas are walked; everything else (enum, * const, default, ...) is data and is never entered. * @param root The document root schema object * @returns The document analysis used for reference resolution */ export declare function analyzeDocument(root: object): DocumentAnalysis; /** * Entry point for all schema conversion. Installs a conversion context for * the outermost call (treating the argument as the document root) and reuses * the active context for nested calls made by handlers, so every node in a * document is analyzed, memoized, and reference-resolvable. * @param schema The schema (or subschema, for nested calls) to convert * @param convert The context-free single-node conversion function * @returns The converted Zod schema */ export declare function runConversion(schema: JSONSchema.BaseSchema | boolean, convert: ConvertFunction): z.ZodTypeAny; /** * A converted $ref/$dynamicRef target. */ export interface ConvertedRef { /** The Zod schema enforcing the reference target. */ schema: z.ZodTypeAny; /** * True when the target's conversion was still in flight (a recursive * reference), in which case `schema` is a deferred memo lookup rather * than the target's completed conversion. */ deferred: boolean; } /** * Resolves and converts the $ref/$dynamicRef targets of a schema node * against the active conversion context. Unresolvable references (unknown * URIs, dangling pointers, unknown anchors, no-progress reference cycles, or * no active context) are omitted, preserving permissive behavior. * @param schema The schema node whose references should be converted * @returns Converted references for each resolvable reference target */ export declare function convertSchemaRefs(schema: JSONSchema.BaseSchema): ConvertedRef[];