import { JsonSchemaResult, JsonSchemaTarget } from "../standard-schema/json-schema.mjs"; import { SchemaContext } from "../types/context-types.mjs"; import { ValidationResult } from "../types/result-types.mjs"; import { BaseValidator } from "./base-validator.mjs"; //#region ../@warlock.js/seal/src/validators/tuple-validator.d.ts /** * Tuple validator class - validates fixed-length arrays with position-specific types * * @example * ```ts * // RGB color tuple * v.tuple([v.number(), v.number(), v.number()]) * // Valid: [255, 128, 0] * // Invalid: [255, 128] (too short) * * // Mixed types * v.tuple([v.string(), v.int(), v.boolean()]) * // Valid: ["John", 25, true] * ``` */ declare class TupleValidator extends BaseValidator { validators: BaseValidator[]; constructor(validators: BaseValidator[], errorMessage?: string); /** * Check if value is an array type */ matchesType(value: any): boolean; /** * Clone the validator */ clone(): this; /** * Validate tuple - check length then validate each position * * Absent input (and absent without `.default()`) propagates as `data: undefined` * so the parent ObjectValidator can omit the key. Without this, optional tuple * fields would silently materialise as `[]` in the validated output and then * fail the length check. */ validate(data: any, context: SchemaContext): Promise; /** * @inheritdoc * * Tuple keyword diverges between targets: * - `draft-2020-12` → `prefixItems` + `items: false` (exact length enforced) * - `draft-07` → `items` as array + `additionalItems: false` * - `openapi-3.0` → same as draft-07 (OpenAPI 3.0 is based on draft-07) * * @example * ```ts * v.tuple([v.string(), v.int(), v.boolean()]).toJsonSchema("draft-2020-12") * // → { * // type: "array", * // prefixItems: [{ type: "string" }, { type: "integer" }, { type: "boolean" }], * // items: false, * // minItems: 3, * // maxItems: 3 * // } * ``` */ toJsonSchema(target?: JsonSchemaTarget): JsonSchemaResult; } //#endregion export { TupleValidator }; //# sourceMappingURL=tuple-validator.d.mts.map