Tuples
Fixed-length arrays with distinct positional types.
Tuples
Tuples validate arrays with a fixed number of elements where each position has a specific schema.
use rod_rs::tuple;
// [String, Number]
let schema = tuple(vec![
Box::new(string()),
Box::new(number())
]);import { rod } from 'rod-js';
const schema = rod.tuple([
rod.string(),
rod.number()
]);import rod
schema = rod.tuple(
rod.string(),
rod.number()
)Validation Rules
- The input must be an array.
- The array length must match the number of defined schemas exactly.
- Each element is validated against the schema at its corresponding index.