pub enum ValidationError {
Show 25 variants
TypeMismatch {
expected: String,
actual: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
MissingRequiredField {
fields: Vec<String>,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
UnknownField {
field: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
OutOfRange {
value: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
StringLengthOutOfBounds {
length: usize,
min: Option<u32>,
max: Option<u32>,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
PatternMismatch {
pattern: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
ArrayLengthOutOfBounds {
length: usize,
min: Option<u32>,
max: Option<u32>,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
MapSizeOutOfBounds {
size: usize,
min: Option<u32>,
max: Option<u32>,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
TupleLengthMismatch {
expected: usize,
actual: usize,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
ArrayNotUnique {
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
ArrayMissingContains {
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
NoVariantMatched {
path: EurePath,
best_match: Option<Box<BestVariantMatch>>,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
AmbiguousUnion {
path: EurePath,
variants: Vec<String>,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
InvalidVariantTag {
tag: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
ConflictingVariantTags {
explicit: String,
repr: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
RequiresExplicitVariant {
variant: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
LiteralMismatch {
expected: String,
actual: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
LanguageMismatch {
expected: String,
actual: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
InvalidKeyType {
key: ObjectKey,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
NotMultipleOf {
divisor: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
UndefinedTypeReference {
name: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
InvalidFlattenTarget {
actual_kind: SchemaKind,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
FlattenMapKeyMismatch {
key: String,
pattern: Option<String>,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
MissingRequiredExtension {
extension: String,
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
},
ParseError {
path: EurePath,
node_id: NodeId,
schema_node_id: SchemaNodeId,
error: ParseError,
},
}Expand description
Type errors accumulated during validation.
These represent mismatches between the document and schema. Validation continues after recording these errors.
Variants§
TypeMismatch
MissingRequiredField
UnknownField
OutOfRange
StringLengthOutOfBounds
Fields
schema_node_id: SchemaNodeIdPatternMismatch
ArrayLengthOutOfBounds
Fields
schema_node_id: SchemaNodeIdMapSizeOutOfBounds
Fields
schema_node_id: SchemaNodeIdTupleLengthMismatch
ArrayNotUnique
ArrayMissingContains
NoVariantMatched
No variant matched in an untagged union validation.
This error occurs when all variants of a union are tried and none succeeds.
When available, best_match provides detailed information about which variant
came closest to matching and why it failed.
For tagged unions (with $variant or VariantRepr), validation errors are
reported directly instead of wrapping them in NoVariantMatched.
Fields
schema_node_id: SchemaNodeIdAmbiguousUnion
InvalidVariantTag
ConflictingVariantTags
RequiresExplicitVariant
LiteralMismatch
LanguageMismatch
InvalidKeyType
Fields
schema_node_id: SchemaNodeIdNotMultipleOf
UndefinedTypeReference
InvalidFlattenTarget
FlattenMapKeyMismatch
Fields
schema_node_id: SchemaNodeIdMissingRequiredExtension
ParseError
Parse error with schema context. Uses custom display to translate ParseErrorKind to user-friendly messages.
Implementations§
Source§impl ValidationError
impl ValidationError
Sourcepub fn node_ids(&self) -> (NodeId, SchemaNodeId)
pub fn node_ids(&self) -> (NodeId, SchemaNodeId)
Get the node IDs associated with this error.
Sourcepub fn deepest_error(&self) -> &ValidationError
pub fn deepest_error(&self) -> &ValidationError
Find the deepest value-focused error in a chain of NoVariantMatched errors.
For nested unions, this walks the best_match chain to find the actual error location, but only for “value-focused” errors (TypeMismatch, LiteralMismatch, etc.) where the deeper span is more useful. For structural errors (MissingRequiredField, UnknownField), we stop at the current level since pointing to the outer block is more helpful.
Sourcepub fn depth(&self) -> usize
pub fn depth(&self) -> usize
Calculate the depth of this error (path length).
Deeper errors indicate that validation got further into the structure before failing, suggesting a better match.
Sourcepub fn priority_score(&self) -> u8
pub fn priority_score(&self) -> u8
Get priority score for error type (higher = more indicative of mismatch).
Used for selecting the “best” variant error when multiple variants fail with similar depth and error counts.
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§fn clone(&self) -> ValidationError
fn clone(&self) -> ValidationError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more