Indicates whether the schema allows undefined
as a valid value.
The type of data that the schema validates, represented as a string.
Coerces the input into a string value.
The current schema instance.
Validates that the string is a valid email address.
Optional configuration for custom email patterns.
The current schema instance.
Validates that the string is a valid ISO 8601 date.
The current schema instance.
Sets the maximum length constraint for the string.
The maximum length allowed.
The current schema instance.
Sets the minimum length constraint for the string.
The minimum length allowed.
The current schema instance.
Marks the schema as optional, allowing undefined
as a valid value.
The current schema instance.
Parses the input data and returns the parsed value.
This method is typically used to coerce or transform the input data into the desired format.
The input data to parse.
The parsed value.
Validates that the string is a valid URL.
The current schema instance.
Validates that the string is a valid UUID.
The current schema instance.
Validates the input data against the string schema.
The data to validate.
The validated string.
Generated using TypeDoc
A schema for validating string values. Provides methods for coercion, optionality, and enforcing constraints like minimum/maximum length, email, UUID, URL, and ISO date formats.
const schema = val.string(); const data = "hello"; const validatedData = schema.validate(data); // Passes console.log(validatedData); // "hello"