ValidationError

Enum ValidationError 

Source
pub enum ValidationError {
Show 75 variants MissingRequiredAttribute { attribute: String, }, InvalidAttributeType { attribute: String, expected: String, actual: String, }, ExpectedMultiValue { attribute: String, }, ExpectedSingleValue { attribute: String, }, UniquenesViolation { attribute: String, }, InvalidCanonicalValue { attribute: String, value: String, allowed: Vec<String>, }, MissingSubAttribute { attribute: String, sub_attribute: String, }, UnknownAttribute { attribute: String, schema_id: String, }, Custom { message: String, }, MissingSchemas, EmptySchemas, InvalidSchemaUri { uri: String, }, UnknownSchemaUri { uri: String, }, DuplicateSchemaUri { uri: String, }, MissingBaseSchema, ExtensionWithoutBase, MissingRequiredExtension, MissingId, EmptyId, InvalidIdFormat { id: String, }, ClientProvidedId, InvalidExternalId, InvalidMetaStructure, MissingResourceType, InvalidResourceType { resource_type: String, }, ClientProvidedMeta, InvalidCreatedDateTime, InvalidModifiedDateTime, InvalidLocationUri, InvalidVersionFormat, InvalidDataType { attribute: String, expected: String, actual: String, }, InvalidStringFormat { attribute: String, details: String, }, InvalidBooleanValue { attribute: String, value: String, }, InvalidDecimalFormat { attribute: String, value: String, }, InvalidIntegerValue { attribute: String, value: String, }, InvalidDateTimeFormat { attribute: String, value: String, }, InvalidBinaryData { attribute: String, details: String, }, InvalidReferenceUri { attribute: String, uri: String, }, InvalidReferenceType { attribute: String, ref_type: String, }, BrokenReference { attribute: String, reference: String, }, SingleValueForMultiValued { attribute: String, }, ArrayForSingleValued { attribute: String, }, MultiplePrimaryValues { attribute: String, }, InvalidMultiValuedStructure { attribute: String, details: String, }, MissingRequiredSubAttribute { attribute: String, sub_attribute: String, }, MissingRequiredSubAttributes { attribute: String, missing: Vec<String>, }, InvalidSubAttributeType { attribute: String, sub_attribute: String, expected: String, actual: String, }, UnknownSubAttribute { attribute: String, sub_attribute: String, }, NestedComplexAttributes { attribute: String, }, MalformedComplexStructure { attribute: String, details: String, }, CaseSensitivityViolation { attribute: String, details: String, }, ReadOnlyMutabilityViolation { attribute: String, }, ImmutableMutabilityViolation { attribute: String, }, WriteOnlyAttributeReturned { attribute: String, }, ServerUniquenessViolation { attribute: String, value: String, }, GlobalUniquenessViolation { attribute: String, value: String, }, InvalidCanonicalValueChoice { attribute: String, value: String, allowed: Vec<String>, }, UnknownAttributeForSchema { attribute: String, schema: String, }, RequiredCharacteristicViolation { attribute: String, characteristic: String, }, UnsupportedAttributeType { attribute: String, type_name: String, }, InvalidAttributeName { actual: String, expected: String, }, RequiredAttributeMissing(String), NullValueForOptionalAttribute(String), ExpectedArray(String), InvalidPrimaryIndex { attribute: String, index: usize, length: usize, }, NotMultiValued(String), ReservedUsername(String), UsernameTooShort(String), UsernameTooLong(String), InvalidUsernameFormat(String), InvalidEmailDomain { email: String, allowed_domains: Vec<String>, }, WorkEmailRequired, ExternalIdRequired, NameComponentRequired, EmptyFormattedName,
}
Expand description

Validation errors for schema compliance checking.

These errors occur when resource data doesn’t conform to the defined schema, providing detailed information about what validation rule was violated.

Variants§

§

MissingRequiredAttribute

Required attribute is missing

Fields

§attribute: String

The name of the missing required attribute

§

InvalidAttributeType

Attribute value doesn’t match expected type

Fields

§attribute: String

The name of the attribute with invalid type

§expected: String

The expected type for this attribute

§actual: String

The actual type that was provided

§

ExpectedMultiValue

Multi-valued attribute provided as single value

Fields

§attribute: String

The name of the attribute that should be multi-valued

§

ExpectedSingleValue

Single-valued attribute provided as array

Fields

§attribute: String

The name of the attribute that should be single-valued

§

UniquenesViolation

Attribute value violates uniqueness constraint

Fields

§attribute: String

The name of the attribute that violates uniqueness

§

InvalidCanonicalValue

Invalid value for attribute with canonical values

Fields

§attribute: String

The name of the attribute with invalid canonical value

§value: String

The invalid value that was provided

§allowed: Vec<String>

The list of allowed canonical values

§

MissingSubAttribute

Complex attribute missing required sub-attributes

Fields

§attribute: String

The name of the complex attribute

§sub_attribute: String

The name of the missing required sub-attribute

§

UnknownAttribute

Unknown attribute in resource

Fields

§attribute: String

The name of the unknown attribute

§schema_id: String

The ID of the schema where the attribute was not found

§

Custom

General validation error with custom message

Fields

§message: String

Custom validation error message

§

MissingSchemas

Missing schemas attribute

§

EmptySchemas

Empty schemas array

§

InvalidSchemaUri

Invalid schema URI format

Fields

§uri: String

The invalid schema URI

§

UnknownSchemaUri

Unknown schema URI

Fields

§uri: String

The unknown schema URI

§

DuplicateSchemaUri

Duplicate schema URI

Fields

§uri: String

The duplicated schema URI

§

MissingBaseSchema

Missing base schema

§

ExtensionWithoutBase

Extension without base schema

§

MissingRequiredExtension

Missing required extension

§

MissingId

Missing id attribute

§

EmptyId

Empty id value

§

InvalidIdFormat

Invalid id format

Fields

§id: String

The invalid ID value that was provided

§

ClientProvidedId

Client provided id in creation

§

InvalidExternalId

Invalid external id

§

InvalidMetaStructure

Invalid meta structure

§

MissingResourceType

Missing meta resource type

§

InvalidResourceType

Invalid meta resource type

Fields

§resource_type: String

The invalid resource type value

§

ClientProvidedMeta

Client provided meta

§

InvalidCreatedDateTime

Invalid created datetime

§

InvalidModifiedDateTime

Invalid modified datetime

§

InvalidLocationUri

Invalid location URI

§

InvalidVersionFormat

Invalid version format

§

InvalidDataType

Invalid data type for attribute

Fields

§attribute: String

The name of the attribute with invalid data type

§expected: String

The expected data type

§actual: String

The actual data type that was provided

§

InvalidStringFormat

Invalid string format

Fields

§attribute: String

The name of the attribute with invalid string format

§details: String

Details about what makes the format invalid

§

InvalidBooleanValue

Invalid boolean value

Fields

§attribute: String

The name of the attribute with invalid boolean value

§value: String

The invalid boolean value that was provided

§

InvalidDecimalFormat

Invalid decimal format

Fields

§attribute: String

The name of the attribute with invalid decimal format

§value: String

The invalid decimal value that was provided

§

InvalidIntegerValue

Invalid integer value

Fields

§attribute: String

The name of the attribute with invalid integer value

§value: String

The invalid integer value that was provided

§

InvalidDateTimeFormat

Invalid datetime format

Fields

§attribute: String

The name of the attribute with invalid datetime format

§value: String

The invalid datetime value that was provided

§

InvalidBinaryData

Invalid binary data

Fields

§attribute: String

The name of the attribute with invalid binary data

§details: String

Details about what makes the binary data invalid

§

InvalidReferenceUri

Invalid reference URI

Fields

§attribute: String

The name of the attribute with invalid reference URI

§uri: String

The invalid URI value that was provided

§

InvalidReferenceType

Invalid reference type

Fields

§attribute: String

The name of the attribute with invalid reference type

§ref_type: String

The invalid reference type that was provided

§

BrokenReference

Broken reference

Fields

§attribute: String

The name of the attribute with broken reference

§reference: String

The broken reference value

§

SingleValueForMultiValued

Single value provided for multi-valued attribute

Fields

§attribute: String

The name of the attribute that requires multiple values

§

ArrayForSingleValued

Array provided for single-valued attribute

Fields

§attribute: String

The name of the attribute that requires a single value

§

MultiplePrimaryValues

Multiple primary values in multi-valued attribute

Fields

§attribute: String

The name of the attribute with multiple primary values

§

InvalidMultiValuedStructure

Invalid multi-valued structure

Fields

§attribute: String

The name of the attribute with invalid multi-valued structure

§details: String

Details about what makes the structure invalid

§

MissingRequiredSubAttribute

Missing required sub-attribute in multi-valued

Fields

§attribute: String

The name of the multi-valued attribute

§sub_attribute: String

The name of the missing required sub-attribute

§

MissingRequiredSubAttributes

Missing required sub-attributes in complex attribute

Fields

§attribute: String

The name of the complex attribute

§missing: Vec<String>

The list of missing required sub-attributes

§

InvalidSubAttributeType

Invalid sub-attribute type in complex attribute

Fields

§attribute: String
§sub_attribute: String
§expected: String
§actual: String
§

UnknownSubAttribute

Unknown sub-attribute in complex attribute

Fields

§attribute: String
§sub_attribute: String
§

NestedComplexAttributes

Nested complex attributes (not allowed)

Fields

§attribute: String
§

MalformedComplexStructure

Malformed complex attribute structure

Fields

§attribute: String
§details: String
§

CaseSensitivityViolation

Case sensitivity violation

Fields

§attribute: String
§details: String
§

ReadOnlyMutabilityViolation

Read-only mutability violation

Fields

§attribute: String
§

ImmutableMutabilityViolation

Immutable mutability violation

Fields

§attribute: String
§

WriteOnlyAttributeReturned

Write-only attribute returned

Fields

§attribute: String
§

ServerUniquenessViolation

Server uniqueness violation

Fields

§attribute: String
§value: String
§

GlobalUniquenessViolation

Global uniqueness violation

Fields

§attribute: String
§value: String
§

InvalidCanonicalValueChoice

Invalid canonical value choice

Fields

§attribute: String
§value: String
§allowed: Vec<String>
§

UnknownAttributeForSchema

Unknown attribute for schema

Fields

§attribute: String
§schema: String
§

RequiredCharacteristicViolation

Required characteristic violation

Fields

§attribute: String
§characteristic: String
§

UnsupportedAttributeType

Unsupported attribute type for value object creation

Fields

§attribute: String
§type_name: String
§

InvalidAttributeName

Invalid attribute name mismatch

Fields

§actual: String
§expected: String
§

RequiredAttributeMissing(String)

Required attribute missing

§

NullValueForOptionalAttribute(String)

Null value for optional attribute (used in factory)

§

ExpectedArray(String)

Expected array for multi-valued attribute

§

InvalidPrimaryIndex

Invalid primary index for multi-valued attribute

Fields

§attribute: String
§index: usize
§length: usize
§

NotMultiValued(String)

Attribute is not multi-valued

§

ReservedUsername(String)

Reserved username error

§

UsernameTooShort(String)

Username too short

§

UsernameTooLong(String)

Username too long

§

InvalidUsernameFormat(String)

Invalid username format

§

InvalidEmailDomain

Invalid email domain

Fields

§email: String
§allowed_domains: Vec<String>
§

WorkEmailRequired

Work email required

§

ExternalIdRequired

External ID required

§

NameComponentRequired

Name component required

§

EmptyFormattedName

Empty formatted name

Implementations§

Source§

impl ValidationError

Source

pub fn missing_required(attribute: impl Into<String>) -> Self

Create a missing required attribute error

Source

pub fn invalid_type( attribute: impl Into<String>, expected: impl Into<String>, actual: impl Into<String>, ) -> Self

Create an invalid type error

Source

pub fn custom(message: impl Into<String>) -> Self

Create a custom validation error

Trait Implementations§

Source§

impl Debug for ValidationError

Source§

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

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

impl Display for ValidationError

Source§

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

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

impl Error for ValidationError

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 From<Error> for ValidationError

Source§

fn from(error: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ValidationError> for ScimError

Source§

fn from(source: ValidationError) -> Self

Converts to this type from the input type.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> TenantValidator for T

Source§

fn validate_tenant_context( &self, expected_tenant_id: &str, context: &RequestContext, ) -> Result<(), String>

Validate that the context has the expected tenant.
Source§

fn validate_single_tenant_context( &self, context: &RequestContext, ) -> Result<(), String>

Validate that the context is for single-tenant operation.
Source§

fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>

Extract tenant context or return error for multi-tenant operations.
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.