Skip to main content

Module valid

Module valid 

Source
Expand description

A typed, validated JSON body extractor.

Valid<T> is the Valid<Json<T>>-style extractor: it reads the request body as JSON into T, then runs T’s Validate check. A parse failure or a validation failure both become a 422 Problem; otherwise the handler receives a value already known to be well-formed and valid.

Structs§

Valid
A request body that deserialized into T and passed T’s Validate check. Destructure it as Valid(value) in a handler.
ValidationError
Why a body was rejected as invalid. A single message in this first cut; a later phase can carry a per-field map.

Traits§

Validate
A domain-shaped validation check on a deserialized body. Keep it cheap and synchronous: structural and range checks, not I/O. Business rules that need ports belong in the application layer, not here.