pub struct ValidationErrorBody {
pub error: String,
pub issues: Vec<ValidationIssue>,
}Expand description
Validation error response body:
{ "error": "Validation failed", "issues": [...] }.
Fields§
§error: StringAlways "Validation failed".
issues: Vec<ValidationIssue>Every issue found.
Implementations§
Source§impl ValidationErrorBody
impl ValidationErrorBody
Sourcepub fn parse<__VldInputT: VldInput + ?Sized>(
input: &__VldInputT,
) -> Result<ValidationErrorBody, VldError>
pub fn parse<__VldInputT: VldInput + ?Sized>( input: &__VldInputT, ) -> Result<ValidationErrorBody, VldError>
Parse and validate input data into this struct.
Accepts any type implementing [VldInput]: JSON strings, file paths,
serde_json::Value, byte slices, etc.
Sourcepub fn parse_value(__vld_json: &Value) -> Result<ValidationErrorBody, VldError>
pub fn parse_value(__vld_json: &Value) -> Result<ValidationErrorBody, VldError>
Parse and validate directly from a serde_json::Value.
Sourcepub fn vld_parse_value(
__vld_json: &Value,
) -> Result<ValidationErrorBody, VldError>
pub fn vld_parse_value( __vld_json: &Value, ) -> Result<ValidationErrorBody, VldError>
Same as parse_value; callable as
T::vld_parse_value without importing vld::schema::VldParse.
Source§impl ValidationErrorBody
impl ValidationErrorBody
Sourcepub fn validate<__VldT: Serialize>(instance: &__VldT) -> Result<(), VldError>
pub fn validate<__VldT: Serialize>(instance: &__VldT) -> Result<(), VldError>
Validate an existing Rust value that can be serialized to JSON.
The value is serialized via serde, then validated against the
schema under the fields’ serialize names (parse() reads
the deserialize names). Returns Ok(()) on success,
Err(VldError) with all issues on failure.
Trait Implementations§
Source§impl Clone for ValidationErrorBody
impl Clone for ValidationErrorBody
Source§impl Debug for ValidationErrorBody
impl Debug for ValidationErrorBody
Source§impl Serialize for ValidationErrorBody
impl Serialize for ValidationErrorBody
Source§impl VldParse for ValidationErrorBody
impl VldParse for ValidationErrorBody
Source§impl VldType for ValidationErrorBody
impl VldType for ValidationErrorBody
Source§type Schema = NestedSchema<ValidationErrorBody, fn(&Value) -> Result<ValidationErrorBody, VldError>>
type Schema = NestedSchema<ValidationErrorBody, fn(&Value) -> Result<ValidationErrorBody, VldError>>
The schema type.
Source§fn vld_schema() -> Self::Schema
fn vld_schema() -> Self::Schema
A fresh schema with no extra checks.
Auto Trait Implementations§
impl Forget for ValidationErrorBody
impl Freeze for ValidationErrorBody
impl RefUnwindSafe for ValidationErrorBody
impl Send for ValidationErrorBody
impl Sync for ValidationErrorBody
impl Unpin for ValidationErrorBody
impl UnsafeUnpin for ValidationErrorBody
impl UnwindSafe for ValidationErrorBody
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more