pub struct ParseDefect {
pub rule_id: String,
pub message: String,
pub span: SourceSpan,
pub resource_id: Option<String>,
pub property_path: Option<String>,
pub phase: Option<DefectPhase>,
}Expand description
A finding produced while parsing a template and building the semantic model.
Field semantics mirror the diagnostic they are converted into downstream:
span is UNKNOWN_SPAN when no source location is known, and the
optional anchors attribute the defect to a named template entity.
Fields§
§rule_id: StringRegistry rule ID of the check this defect belongs to.
message: String§span: SourceSpanSource location, or UNKNOWN_SPAN when none has been resolved yet.
resource_id: Option<String>Logical ID of the resource (or output pseudo-resource) the defect is anchored to, when it targets one.
property_path: Option<String>Slash- or dot-separated path locating the defect within the template.
phase: Option<DefectPhase>Pipeline stage attribution; None lets downstream enrichment derive it.
Implementations§
Source§impl ParseDefect
impl ParseDefect
Sourcepub fn new(rule_id: impl Into<String>, message: impl Into<String>) -> Self
pub fn new(rule_id: impl Into<String>, message: impl Into<String>) -> Self
Starts a defect for rule_id carrying message. All anchors default to
absent and are added through the builder-style methods below.
Sourcepub fn location(self, span: SourceSpan) -> Self
pub fn location(self, span: SourceSpan) -> Self
Sets the source span.
Sourcepub fn resource(self, resource_id: impl Into<String>) -> Self
pub fn resource(self, resource_id: impl Into<String>) -> Self
Anchors the defect to a resource logical ID. An empty ID is dropped so callers can pass through an ID that may be blank.
Sourcepub fn property_path(self, property_path: impl Into<String>) -> Self
pub fn property_path(self, property_path: impl Into<String>) -> Self
Records the property path. An empty path is ignored so callers can pass through a path that may be blank.
Sourcepub fn phase(self, phase: DefectPhase) -> Self
pub fn phase(self, phase: DefectPhase) -> Self
Pins the pipeline stage the defect belongs to.
Sourcepub fn is_fatal(&self) -> bool
pub fn is_fatal(&self) -> bool
Whether this defect represents a fatal structural failure. Built-in rule IDs encode severity in their prefix letter, and this crate assigns every parse rule ID, so the prefix is authoritative here.
Sourcepub fn resource_logical_id(&self) -> Option<&str>
pub fn resource_logical_id(&self) -> Option<&str>
Logical ID of the resource the defect is anchored to, when it targets one.