Types topic
The primitives a schema validates: one class per Dart type.
VString, VNumber with its VInt and VDouble refinements, VBool and
VDate cover the values that arrive from a form, a JSON payload or a query
string. VEnum, VLiteral and VUnion cover the shapes a plain type cannot
express: one of a fixed set, one exact value, one of several schemas.
Every method returns the concrete subtype, so a chain keeps its type all the
way down and V.string().trim().email() is still a VString. VTransformed
and VTransformedAsync are what a chain becomes after transform, when the
output type stops matching the input.
Classes
- VBool Types
- Validates bool values.
- VDate Types
- Validates DateTime values.
- VDouble Types
- Validates double values.
-
VEnum<
T extends Enum> Types - Validates that a value belongs to a set of enum values.
- VInt Types
- Validates int values.
-
VLiteral<
T> Types - Validates that a value is exactly equal to the expected literal.
-
VNumber<
T extends num> Types - Abstract base for numeric validation types (VInt and VDouble).
- VString Types
- Validates String values.
-
VTransformed<
I, O> Types - Wraps a schema and transforms its output to a different type.
-
VTransformedAsync<
I, O> Types - Wraps a schema and asynchronously transforms its output to a different type.
- VUnion Types
- Validates that a value matches at least one of the given schemas.