Tuple
Tuple schemas validate fixed-length arrays where each element has a specific type.
use zod_rs::prelude::*;use serde_json::json;
let schema = tuple() .item(string()) .item(number());
assert!(schema.safe_parse(&json!(["hello", 42])).is_ok());assert!(schema.safe_parse(&json!(["hello"])).is_err()); // too fewassert!(schema.safe_parse(&json!([42, "hello"])).is_err()); // wrong typesUsage with enums
Section titled “Usage with enums”Tuples are used internally for enum variants with multiple fields:
#[derive(ZodSchema)]enum Message { Coords(i32, i32), // validated as {"Coords": [number, number]}}See the Enums section for more details.