Skip to main content

ValidationErrorKind

Enum ValidationErrorKind 

Source
pub enum ValidationErrorKind {
Show 35 variants AdditionalItems { limit: usize, }, AdditionalProperties { unexpected: Vec<String>, }, AnyOf { context: Vec<Vec<ValidationError<'static>>>, }, BacktrackLimitExceeded { error: Error, }, Constant { expected_value: Value, }, Contains, ContentEncoding { content_encoding: String, }, ContentMediaType { content_media_type: String, }, Custom { keyword: String, message: String, }, Enum { options: Value, }, ExclusiveMaximum { limit: Value, }, ExclusiveMinimum { limit: Value, }, FalseSchema, Format { format: String, }, FromUtf8 { error: FromUtf8Error, }, MaxItems { limit: u64, }, Maximum { limit: Value, }, MaxLength { limit: u64, }, MaxProperties { limit: u64, }, MinItems { limit: u64, }, Minimum { limit: Value, }, MinLength { limit: u64, }, MinProperties { limit: u64, }, MultipleOf { multiple_of: f64, }, Not { schema: Value, }, OneOfMultipleValid { context: Vec<Vec<ValidationError<'static>>>, }, OneOfNotValid { context: Vec<Vec<ValidationError<'static>>>, }, Pattern { pattern: String, }, PropertyNames { error: Box<ValidationError<'static>>, }, Required { property: Value, }, Type { kind: TypeKind, }, UnevaluatedItems { unexpected: Vec<String>, }, UnevaluatedProperties { unexpected: Vec<String>, }, UniqueItems, Referencing(Error),
}
Expand description

Kinds of errors that may happen during validation

Variants§

§

AdditionalItems

The input array contain more items than expected.

Fields

§limit: usize
§

AdditionalProperties

Unexpected properties.

Fields

§unexpected: Vec<String>
§

AnyOf

The input value is not valid under any of the schemas listed in the ‘anyOf’ keyword.

Fields

§context: Vec<Vec<ValidationError<'static>>>
§

BacktrackLimitExceeded

Results from a fancy_regex::RuntimeError::BacktrackLimitExceeded variant when matching

Fields

§error: Error
§

Constant

The input value doesn’t match expected constant.

Fields

§expected_value: Value
§

Contains

The input array doesn’t contain items conforming to the specified schema.

§

ContentEncoding

The input value does not respect the defined contentEncoding

Fields

§content_encoding: String
§

ContentMediaType

The input value does not respect the defined contentMediaType

Fields

§content_media_type: String
§

Custom

Custom error message for user-defined validation.

Fields

§keyword: String
§message: String
§

Enum

The input value doesn’t match any of specified options.

Fields

§options: Value
§

ExclusiveMaximum

Value is too large.

Fields

§limit: Value
§

ExclusiveMinimum

Value is too small.

Fields

§limit: Value
§

FalseSchema

Everything is invalid for false schema.

§

Format

When the input doesn’t match to the specified format.

Fields

§format: String
§

FromUtf8

May happen in contentEncoding validation if base64 encoded data is invalid.

Fields

§

MaxItems

Too many items in an array.

Fields

§limit: u64
§

Maximum

Value is too large.

Fields

§limit: Value
§

MaxLength

String is too long.

Fields

§limit: u64
§

MaxProperties

Too many properties in an object.

Fields

§limit: u64
§

MinItems

Too few items in an array.

Fields

§limit: u64
§

Minimum

Value is too small.

Fields

§limit: Value
§

MinLength

String is too short.

Fields

§limit: u64
§

MinProperties

Not enough properties in an object.

Fields

§limit: u64
§

MultipleOf

When some number is not a multiple of another number.

Fields

§multiple_of: f64
§

Not

Negated schema failed validation.

Fields

§schema: Value
§

OneOfMultipleValid

The given schema is valid under more than one of the schemas listed in the ‘oneOf’ keyword.

Fields

§context: Vec<Vec<ValidationError<'static>>>
§

OneOfNotValid

The given schema is not valid under any of the schemas listed in the ‘oneOf’ keyword.

Fields

§context: Vec<Vec<ValidationError<'static>>>
§

Pattern

When the input doesn’t match to a pattern.

Fields

§pattern: String
§

PropertyNames

Object property names are invalid.

Fields

§error: Box<ValidationError<'static>>
§

Required

When a required property is missing.

Fields

§property: Value
§

Type

When the input value doesn’t match one or multiple required types.

Fields

§

UnevaluatedItems

Unexpected items.

Fields

§unexpected: Vec<String>
§

UnevaluatedProperties

Unexpected properties.

Fields

§unexpected: Vec<String>
§

UniqueItems

When the input array has non-unique elements.

§

Referencing(Error)

Error during schema ref resolution.

Implementations§

Trait Implementations§

Source§

impl Debug for ValidationErrorKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more