Skip to main content

ValidateFields

Trait ValidateFields 

pub trait ValidateFields {
    // Required method
    fn validate_at(&self, path: &FieldPath<'_>) -> Result<(), CratestackError>;

    // Provided method
    fn validate(&self) -> Result<(), CratestackError> { ... }
}

Required Methods§

fn validate_at(&self, path: &FieldPath<'_>) -> Result<(), CratestackError>

Run the validators of self and of everything it contains. path is where self sits in the request body: FieldPath::Root for the arguments, args for the value of the argument args, args.items[2] for its third item. The error names the field by that path, so a nested failure points at the offending leaf; the path is written only when a validator fails.

Provided Methods§

fn validate(&self) -> Result<(), CratestackError>

Self::validate_at from the root of the request body.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§