remove redundant trait bound; add support for validify

This commit is contained in:
gengteng
2023-10-17 10:57:26 +08:00
parent 72dc8142d2
commit 61bf3c5b23
20 changed files with 1482 additions and 32 deletions

View File

@@ -20,6 +20,8 @@ pub mod typed_header;
pub mod typed_multipart;
#[cfg(feature = "validator")]
pub mod validator;
#[cfg(feature = "validify")]
pub mod validify;
#[cfg(feature = "yaml")]
pub mod yaml;
@@ -37,7 +39,7 @@ pub const VALIDATION_ERROR_STATUS: StatusCode = StatusCode::BAD_REQUEST;
/// Trait for types that can supply a reference that can be validated.
///
/// Extractor types `T` that implement this trait can be used with `Valid` or `Garde`.
/// Extractor types `T` that implement this trait can be used with `Valid`, `Garde` or `Validated`.
///
pub trait HasValidate {
/// Inner type that can be validated for correctness
@@ -52,6 +54,11 @@ pub use crate::validator::{Arguments, HasValidateArgs, Valid, ValidEx, ValidReje
#[cfg(feature = "garde")]
pub use crate::garde::{Garde, GardeRejection};
#[cfg(feature = "validify")]
pub use crate::validify::{
HasModify, HasValidify, Modified, PayloadExtractor, Validated, Validified, ValidifyRejection,
};
/// `ValidationRejection` is returned when the validation extractor fails.
///
/// This enumeration captures two types of errors that can occur when using `Valid`: errors related to the validation