/** * On-demand validation against the schema. * * A port of the Python library's `idfkit.validation`, kept deliberately close * to it: the same checks in the same order producing the same `code` strings, * so the conformance corpus can hold the two implementations against one * another. Where the slim schema cannot express what the Python side reads out * of the full epJSON schema, the difference is called out at the check rather * than papered over. * * Nothing here is eager. Parsing never validates; you validate when you want * to, over the object types you care about. */ import type { Schema } from '@idfkit/schemas'; import type { IdfDocument } from '../document.js'; import type { IdfObject } from '../object.js'; import type { AnyTypeMap, UntypedMap } from '../typemap.js'; import { type ValidationError, type ValidationResult } from './types.js'; /** Which checks a document run performs. Every one defaults to on. */ interface ValidateDocumentOptions { /** * Schema to validate against. Defaults to the document's own, which is what * you want unless you are asking "would this model load under 25.2?". */ schema?: Schema; /** Report references whose target no object provides. */ checkReferences?: boolean; /** Report required fields that are absent or blank. */ checkRequired?: boolean; /** Report values whose type the schema does not allow. */ checkTypes?: boolean; /** Report numeric values outside their declared bounds. */ checkRanges?: boolean; /** Report singleton types present more than once. */ checkSingletons?: boolean; /** Restrict the run to these object types. Omit for all of them. */ objectTypes?: readonly string[]; } /** Which checks a single-object run performs. Every one defaults to on. */ interface ValidateObjectOptions { /** Report required fields that are absent or blank. */ checkRequired?: boolean; /** Report values whose type the schema does not allow. */ checkTypes?: boolean; /** Report numeric values outside their declared bounds. */ checkRanges?: boolean; /** Report fields the schema does not define. */ checkUnknown?: boolean; } /** * Validate a whole document. * * Findings are split by severity; `errors` being empty is what `isValid` means. * Nothing throws: a model that cannot load is described, not raised. * * @example * ```ts * const result = validateDocument(doc); * if (!result.isValid) { * for (const error of result.errors) console.error(error.code, error.message); * } * ``` */ export declare function validateDocument(doc: IdfDocument, options?: ValidateDocumentOptions): ValidationResult; /** * Validate one object, attached or detached. * * Useful right after building an object, before it goes anywhere near a * document. The schema is passed explicitly rather than taken from the object * so that "does this object hold up under another EnergyPlus version?" is * askable; a type the schema does not define is reported as `W002` rather than * throwing. * * @example * ```ts * const material = doc.add('Material', 'Gypsum', { roughness: 'Smooth' }); * const findings = validateObject(material, doc.schema); * ``` */ export declare function validateObject(obj: IdfObject, schema: Schema, options?: ValidateObjectOptions): ValidationError[]; export {}; //# sourceMappingURL=validate.d.ts.map