import type { ErrorObject, ValidateFunction } from 'ajv'; import { LineCounter, parseDocument } from 'yaml'; import type { Diagnostic, WorkspaceSource } from './compiler.js'; export interface SourceLocation { readonly path: string; readonly pointer: string; readonly line: number; readonly column: number; } export interface ValidatedSourceDocument { readonly value: T; readonly yaml: ReturnType; readonly lineCounter: LineCounter; } export type SourceDocumentResult = { readonly ok: true; readonly document: ValidatedSourceDocument; } | { readonly ok: false; readonly diagnostics: readonly Diagnostic[]; }; export declare const diagnosticOrder: (left: Diagnostic, right: Diagnostic) => number; export declare const describeSchemaViolation: (error: Pick) => string; /** * The errors worth reading, in the order Ajv found them. * * A discriminated union raises two errors when the tag itself is missing or * mistyped: the `required`/`type` fault that names the property, and a * `discriminator` row restating it. The second says nothing the first did not, * so it is dropped. A tag that is present but names no branch keeps its row - * that one is the only report of the fault. */ export declare const readableSchemaErrors: >(errors: readonly T[]) => readonly T[]; export declare const closestCandidate: (value: string, candidates: Iterable) => string | undefined; export declare function locateSourcePath(sourcePath: string, yaml: ReturnType, lineCounter: LineCounter, yamlPath: readonly (string | number)[], pointer: string): SourceLocation; export declare function loadSourceDocument(source: WorkspaceSource, validate: ValidateFunction, schemaLabel: string): SourceDocumentResult;