/** * Schema validation for pipe output * Validates that query responses match the declared output schema */ import type { ProjectDefinition } from "../../schema/project.js"; import type { PipeDefinition, OutputDefinition } from "../../schema/pipe.js"; import type { ColumnMeta } from "../../client/types.js"; import type { LoadedEntities } from "../../generator/loader.js"; /** * Options for schema validation */ export interface SchemaValidationOptions { /** The project definition containing pipe schemas (legacy) */ project?: ProjectDefinition; /** The loaded entities containing pipe schemas (new) */ entities?: LoadedEntities; /** Names of pipes to validate */ pipeNames: string[]; /** Tinybird API base URL */ baseUrl: string; /** API token for authentication */ token: string; } /** * A single validation issue */ export interface ValidationIssue { /** Name of the pipe with the issue */ pipeName: string; /** Issue severity */ type: "error" | "warning"; /** Human-readable description of the issue */ message: string; } /** * Result of schema validation */ export interface SchemaValidationResult { /** Whether all validations passed (no errors) */ valid: boolean; /** List of validation issues found */ issues: ValidationIssue[]; /** Names of pipes that were successfully validated */ pipesValidated: string[]; /** Names of pipes that were skipped (e.g., require params) */ pipesSkipped: string[]; } /** * Internal result of validating a single pipe's output schema */ interface ColumnValidation { valid: boolean; missingColumns: { name: string; expectedType: string; }[]; extraColumns: { name: string; actualType: string; }[]; typeMismatches: { name: string; expectedType: string; actualType: string; }[]; } /** * Validate pipe schemas by querying them and comparing response to output definition * * @param options - Validation options * @returns Validation result with issues found */ export declare function validatePipeSchemas(options: SchemaValidationOptions): Promise; /** * Check if a pipe has any required parameters without defaults */ declare function hasRequiredParams(pipe: PipeDefinition): boolean; /** * Build a params object using default values from the pipe definition */ declare function buildDefaultParams(pipe: PipeDefinition): Record; /** * Validate response metadata against the expected output schema */ declare function validateOutputSchema(responseMeta: ColumnMeta[], outputSchema: OutputDefinition): ColumnValidation; /** * Check if two ClickHouse types are compatible * Handles Nullable, LowCardinality, and timezone variations */ declare function typesAreCompatible(actual: string, expected: string): boolean; export { typesAreCompatible as _typesAreCompatible }; export { validateOutputSchema as _validateOutputSchema }; export { hasRequiredParams as _hasRequiredParams }; export { buildDefaultParams as _buildDefaultParams }; //# sourceMappingURL=schema-validation.d.ts.map