Enums
Validating against a fixed set of string values.
Enums
Enums validate that a string matches one of the allowed values in a predefined list.
use rod_rs::enum_type;
let schema = enum_type(vec!["admin", "user", "guest"]);import { rod } from 'rod-js';
const schema = rod.enum("admin", "user", "guest");import rod
schema = rod.enum("admin", "user", "guest")Performance
Internally, Rod optimizes enums by checking the input string against the allowed list directly, bypassing the overhead of standard union trial-and-error.