pub enum ValidationError {
TypeMismatch {
path: String,
expected: String,
actual: String,
source_token: String,
default: Option<String>,
},
EnumViolation {
path: String,
value: String,
allowed: Vec<String>,
},
FormatViolation {
path: String,
format: String,
},
UnknownCard {
path: String,
card: String,
},
BodyDisabled {
path: String,
card: String,
},
NotInline {
path: String,
},
NotPlain {
path: String,
},
}Expand description
Validation error with a structured field path.
Field-level type and presence errors carry the field path, the
schema-declared type, and any verbatim YAML source token / default —
enough for the Display impl to render the uniform diagnostic message
described in ERROR.md (“Validation message contract”).
Two concerns are deliberately not well-formedness errors and so have no
variant here: the !must_fill marker (surfaced as a non-fatal warning by
Quill::validate) and field absence (an absent or present-null field
zero-fills at render). Both are handled outside the value-layer checks below.
Variants§
TypeMismatch
Fields
actual: StringYAML-parsed type of the source token (integer, number,
boolean, null, string, array, object).
EnumViolation
FormatViolation
UnknownCard
BodyDisabled
NotInline
A richtext(inline) field whose content is not single-Para (a block, a
list/quote container, or an island). Same fatality class as
TypeMismatch — the value is well-typed richtext but the wrong shape
for an inline field.
NotPlain
A plaintext field whose content carries marks, islands, or block
formatting. Same fatality class as TypeMismatch — the value is a
well-formed content but the wrong shape for a plaintext field, which
takes prose the author navigates but no formatting.
Implementations§
Source§impl ValidationError
impl ValidationError
Sourcepub fn path(&self) -> &str
pub fn path(&self) -> &str
Document-model path anchor for this error.
See crate::error module docs for the path grammar and conventions.
Sourcepub fn code(&self) -> &'static str
pub fn code(&self) -> &'static str
Stable diagnostic code for this error variant. Pattern-match on this instead of the message text.
Sourcepub fn hint(&self) -> Option<String>
pub fn hint(&self) -> Option<String>
Actionable hint for this error, when defined for the variant — the same
string the Display impl bakes in, exposed so consumers can surface it
without re-parsing prose.
Sourcepub fn to_diagnostic(&self) -> Diagnostic
pub fn to_diagnostic(&self) -> Diagnostic
Convert this error into a structured Diagnostic carrying the
stable code, the document-model path, the canonical message, and
the actionable hint (when the variant defines one).
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§fn clone(&self) -> ValidationError
fn clone(&self) -> ValidationError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl Display for ValidationError
impl Display for ValidationError
impl Eq for ValidationError
Source§impl Error for ValidationError
impl Error for ValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for ValidationError
impl PartialEq for ValidationError
impl StructuralPartialEq for ValidationError
Auto Trait Implementations§
impl Freeze for ValidationError
impl RefUnwindSafe for ValidationError
impl Send for ValidationError
impl Sync for ValidationError
impl Unpin for ValidationError
impl UnsafeUnpin for ValidationError
impl UnwindSafe for ValidationError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.