import { ErrorObject } from "ajv"; export interface ValidateOptions { schemaKey: string; object: any; addDefaults?: boolean; /** * When true, `ValidateResult.errorObjects` is populated with the raw AJV * `ErrorObject`s from the target-schema validation (empty array when valid or * when the schema key is unknown). Off by default so the hot runner path pays * nothing; the LSP opts in to map `instancePath`/`keyword`/`params` to source * ranges. The string `errors` field is always produced regardless. */ structuredErrors?: boolean; } export interface ValidateResult { valid: boolean; errors: string; object: any; /** * Raw AJV errors from the target-schema validation. Present only when * `structuredErrors: true` was passed. Snapshotted (shallow-cloned) so the * shared AJV instance's error array can't mutate them out from under a caller. */ errorObjects?: ErrorObject[]; } export interface TransformOptions { currentSchema: string; targetSchema: string; object: any; } /** * Validates an object against a specified JSON schema, supporting backward compatibility and automatic transformation from older schema versions if needed. * * If validation against the target schema fails and compatible older schemas are defined, attempts validation against each compatible schema. On a match, transforms the object to the target schema and revalidates. Returns the validation result, any errors, and the (possibly transformed) object. * * @param options - Validation options * @param options.schemaKey - The key identifying the target JSON schema. * @param options.object - The object to validate. * @param options.addDefaults - Whether to include default values in the returned object. * @returns Validation result, error messages, and the validated (and possibly transformed) object. * * @throws {Error} If {@link schemaKey} or {@link object} is missing. */ export declare function validate({ schemaKey, object, addDefaults, structuredErrors, }: ValidateOptions): ValidateResult; /** * Transform an object from one schema key to another and return a validated instance of the target schema. * * @param params - Function parameters. * @param params.currentSchema - Schema key representing the object's current version. * @param params.targetSchema - Schema key to transform the object into. * @param params.object - The source object to transform. * @returns The transformed object conforming to the target schema. * @throws {Error} If transformation between the specified schemas is not supported or if the transformed object fails validation. */ export declare function transformToSchemaKey({ currentSchema, targetSchema, object, }: TransformOptions): any; //# sourceMappingURL=validate.d.ts.map