Skip to main content

Crate vld_rama

Crate vld_rama 

Source
Expand description

§vld-rama — Rama integration for the vld validation library

Provides extractors and a ValidateJsonLayer that validate HTTP request data using vld schemas (no serde::Deserialize required):

APISource
VldJson<T>JSON request body
VldQuery<T>URL query parameters
VldPath<T>URL path parameters
VldForm<T>URL-encoded form body
VldHeaders<T>HTTP headers
VldCookie<T>Cookie values
ValidateJsonLayer<T>Middleware for Service stacks

All extractors return 422 Unprocessable Entity on validation failure.

Requires Rust 1.96+ (Rama MSRV).

Modules§

prelude
Prelude — import everything you need.

Structs§

ValidateJsonLayer
A Rama Layer that validates JSON request bodies with vld.
ValidateJsonService
Service produced by ValidateJsonLayer.
Validated
Wrapper stored in Rama Extensions so validated values do not require a manual Extension impl on T.
VldCookie
Rama extractor that validates cookie values from the Cookie header.
VldForm
Rama extractor that validates URL-encoded form bodies.
VldHeaders
Rama extractor that validates HTTP headers.
VldJson
Rama extractor that validates JSON request bodies.
VldPath
Rama extractor that validates URL path parameters.
VldQuery
Rama extractor that validates URL query parameters.
VldRejection
Rejection returned when validation (or body parsing) fails.

Functions§

try_validated
Try to extract the validated value from request extensions.
validated
Extract the validated value from request extensions.