Skip to main content

DocumentValidationError

Enum DocumentValidationError 

Source
pub enum DocumentValidationError {
    MissingRequiredField(String),
    InvalidType {
        field_id: String,
        expected_type: String,
        got_type: String,
    },
    ValueTooLow {
        field_id: String,
        value: f64,
        min: f64,
    },
    ValueTooHigh {
        field_id: String,
        value: f64,
        max: f64,
    },
    InvalidSelection {
        field_id: String,
        value: String,
        allowed: Vec<String>,
    },
    InvalidDateFormat {
        field_id: String,
        value: String,
    },
    FormIdMismatch {
        doc_form: String,
        def_id: String,
    },
}
Expand description

Represents errors encountered during the document validation process.

Variants§

§

MissingRequiredField(String)

Indicates that a required field was missing from the document or its value was null.

§

InvalidType

Indicates a type mismatch for a field’s value.

Fields

§field_id: String

The ID of the field that had an invalid type.

§expected_type: String

The expected data type for the field.

§got_type: String

The actual data type received for the field.

§

ValueTooLow

Indicates that a numerical field’s value is below its specified minimum.

Fields

§field_id: String

The ID of the numerical field.

§value: f64

The value that was too low.

§min: f64

The minimum allowed value for the field.

§

ValueTooHigh

Indicates that a numerical field’s value is above its specified maximum.

Fields

§field_id: String

The ID of the numerical field.

§value: f64

The value that was too high.

§max: f64

The maximum allowed value for the field.

§

InvalidSelection

Indicates that a selection field’s value is not among the allowed options.

Fields

§field_id: String

The ID of the selection field.

§value: String

The invalid value received.

§allowed: Vec<String>

The list of allowed options for the field.

§

InvalidDateFormat

Indicates that a date/time field’s value is not in a valid ISO 8601 format.

Fields

§field_id: String

The ID of the date field.

§value: String

The invalid date string received.

§

FormIdMismatch

Indicates that the document’s form_id does not match the FormDefinition’s ID.

Fields

§doc_form: String

The form_id specified in the document.

§def_id: String

The id specified in the FormDefinition.

Trait Implementations§

Source§

impl Debug for DocumentValidationError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DocumentValidationError

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for DocumentValidationError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Error for DocumentValidationError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for DocumentValidationError

Source§

fn eq(&self, other: &DocumentValidationError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DocumentValidationError

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DocumentValidationError

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, 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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> ValidateIp for T
where T: ToString,

Source§

fn validate_ipv4(&self) -> bool

Validates whether the given string is an IP V4
Source§

fn validate_ipv6(&self) -> bool

Validates whether the given string is an IP V6
Source§

fn validate_ip(&self) -> bool

Validates whether the given string is an IP
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,