Skip to main content

ValidationIssue

Struct ValidationIssue 

Source
pub struct ValidationIssue {
    pub severity: Severity,
    pub category: Category,
    pub source: IssueSource,
    pub location: Location,
    pub code: String,
    pub message: String,
    pub suggestion: Option<String>,
    pub context: HashMap<String, String>,
    pub additional_instances: Vec<Location>,
}
Expand description

A single validation issue

Fields§

§severity: Severity

Severity level

§category: Category

Category of issue

§source: IssueSource

Authority that emitted this issue (XSD layer, prose rule, engine internal). Inferred from code at construction time so the field is always consistent with the code prefix — JS consumers can filter on issue.source directly without re-implementing the inference. Deserialised with a default so old reports without the field round-trip cleanly.

§location: Location

Location where issue was found

§code: String

Error code (e.g., “ST2067-2:2020:8.3/FileNotFound”)

§message: String

Human-readable message

§suggestion: Option<String>

Suggestion for how to fix

§context: HashMap<String, String>

Additional context

§additional_instances: Vec<Location>

Other Locations when this issue represents an aggregation of multiple identical-code occurrences (see ValidationReport::aggregate). Empty for fresh, un-aggregated issues. Skipped during serialisation when empty so the on-wire shape stays back-compatible for callers that don’t aggregate.

Implementations§

Source§

impl ValidationIssue

Source

pub fn new( severity: Severity, category: Category, code: impl Into<String>, message: impl Into<String>, ) -> Self

Source

pub fn from_code<C: ValidationCode>(code: C, message: impl Into<String>) -> Self

Build a ValidationIssue directly from a typed ValidationCode, reading severity + category from the catalogue rather than the caller. Use this for any rule whose code lives in one of the *_codes modules — the catalogue is the single source of truth for severity and category. Pass the bare enum value:

use imferno_core::mxf::codes::St2067_2_2016;
let issue = ValidationIssue::from_code(
    St2067_2_2016::AudioSampleRateUnsupported,
    format!("got {hz} Hz"),
);
Source

pub fn instance_count(&self) -> usize

Number of occurrences this issue represents. 1 for a fresh issue, 1 + additional_instances.len() after aggregation.

JS consumers can compute this themselves as 1 + issue.additionalInstances.length — the field is the source of truth, this method is a Rust-side convenience.

Source

pub fn with_location(self, location: Location) -> Self

Source

pub fn with_suggestion(self, suggestion: impl Into<String>) -> Self

Source

pub fn with_context( self, key: impl Into<String>, value: impl Into<String>, ) -> Self

Trait Implementations§

Source§

impl Clone for ValidationIssue

Source§

fn clone(&self) -> ValidationIssue

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ValidationIssue

Source§

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

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

impl<'de> Deserialize<'de> for ValidationIssue

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 ValidationIssue

Source§

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

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

impl From<&FileValidationError> for ValidationIssue

Source§

fn from(err: &FileValidationError) -> Self

Converts to this type from the input type.
Source§

impl Serialize for ValidationIssue

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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.