Skip to main content

Module prelude

Module prelude 

Source

Re-exports§

pub use crate::validate_insert;
pub use crate::validate_row;
pub use crate::validate_rows;
pub use crate::validate_update;
pub use crate::Validated;
pub use crate::VldBool;
pub use crate::VldFloat;
pub use crate::VldInt;
pub use crate::VldSqlxError;
pub use crate::VldText;

Structs§

FieldResult
Result of validating a single field.
IssueBuilder
Fluent builder for constructing a single ValidationIssue.
ParseResult
Result of lenient parsing: contains the (possibly partial) struct and per-field diagnostics.
ValidationIssue
A single validation issue with path, message and received value.
VldError
Collection of validation errors.
ZAny
Schema that accepts any JSON value. Created via vld::any().
ZArray
Schema for array validation. Created via vld::array().
ZBoolean
Schema for boolean validation. Created via vld::boolean().
ZCatch
Wraps a schema with a fallback value returned on ANY validation error.
ZCustom
Schema from a custom validation function.
ZDefault
Wraps a schema to provide a default value when the input is null or missing.
ZDescribe
Wraps a schema with a human-readable description.
ZDiscriminatedUnion
Discriminated union: chooses a schema based on a discriminator field value.
ZEnum
Schema for string enum validation. Created via vld::enumeration().
ZInt
Schema for integer validation (i64). Created via vld::number().int().
ZIntersection
Intersection of two schemas: input must satisfy both.
ZLazy
Lazy schema for recursive/self-referencing data structures.
ZLiteral
Schema for exact value matching. Created via vld::literal().
ZMap
Schema for validating a JSON array of [key, value] pairs into a HashMap.
ZMessage
Override the error message for an inner schema.
ZNullable
Wraps a schema to allow null values.
ZNullish
Wraps a schema to make it both optional and nullable (nullish).
ZNumber
Schema for number validation (f64). Created via vld::number().
ZObject
ZOptional
Wraps a schema to make it optional.
ZPipe
Chains two schemas: output of the first is serialized to JSON, then parsed by the second.
ZPreprocess
Applies a preprocessing function to the JSON value before validation.
ZRecord
Schema for validating JSON objects as key-value records. Created via vld::record().
ZRefine
Adds a custom refinement check to a schema without changing its output type.
ZSet
Schema for validating a JSON array into a HashSet (unique elements).
ZString
Schema for string validation. Created via vld::string().
ZSuperRefine
Refinement that can produce multiple errors at once.
ZTransform
Transforms the output of a schema after successful parsing.
ZUnion2
Union of two schemas. Tries the first, then the second.
ZUnion3
Union of three schemas.

Enums§

Either
A value that can be one of two types.
Either3
A value that can be one of three types.
IssueCode
Validation issue code — describes what went wrong.
PathSegment
A segment in a validation error path.

Traits§

IntoLiteral
Trait for types that can be used as literal values.
VldInput
Trait for types that can be used as input to schema parsing.
VldParse
Trait for types that can be parsed from a serde_json::Value.
VldSchema
Core validation schema trait.

Functions§

flatten_error
Flatten a VldError into a simple field-based structure.
prettify_error
Format a VldError into a human-readable string.
treeify_error
Convert a VldError into a tree structure that mirrors the schema.