#[non_exhaustive]pub struct ValidationError {
pub file: PathBuf,
pub line: usize,
pub column: usize,
pub json_path: String,
pub raw_value: String,
pub normalized_id: String,
pub error: String,
pub context: String,
}Expand description
A single validation error found in a documentation/config file.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.file: PathBufFile path where the error was found
line: usizeLine number (1-indexed) — for .md files; 0 for structured files
column: usizeColumn number (1-indexed) — for .md files; 0 for structured files
json_path: StringJSON path (e.g., “$.properties.type.x-gts-ref”) — for .json/.yaml files; empty for .md
raw_value: StringThe original raw string that was found
normalized_id: StringThe normalized GTS identifier (after stripping gts://, etc.)
error: StringHuman-readable error description
context: StringSurrounding context (for .md: the line content; for .json/.yaml: the parent key)
Implementations§
Source§impl ValidationError
impl ValidationError
Sourcepub fn format_human_readable(&self) -> String
pub fn format_human_readable(&self) -> String
Format the error for human-readable output.
For markdown errors: {file}:{line}:{column}: {error} [{raw_value}]
For JSON/YAML errors: {file}: {error} [{raw_value}] (at {json_path})
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§fn clone(&self) -> ValidationError
fn clone(&self) -> ValidationError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValidationError
impl Debug for ValidationError
impl Eq for ValidationError
Source§impl PartialEq for ValidationError
impl PartialEq for ValidationError
Source§fn eq(&self, other: &ValidationError) -> bool
fn eq(&self, other: &ValidationError) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ValidationError
impl Serialize 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
Mutably borrows from an owned value. Read more
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> GtsSerialize for Twhere
T: Serialize,
impl<T> GtsSerialize for Twhere
T: Serialize,
Source§fn gts_serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn gts_serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value using the GTS serialization protocol. Read more