public extension PureYAML.Validation { /// Path-aware validation error. struct ValidationError: Swift.Error, Equatable, Sendable, CustomStringConvertible { public var severity: Severity public var reason: String public var path: Path public init( severity: Severity, reason: String, path: Path = .root, ) { self.severity = severity self.reason = reason self.path = path } /// Strips a trailing period from `reason` and renders the location consistently: /// `" at root of document"` at the root, `" at path: "` elsewhere. /// `severity` is a separate stored property (see `Result.errors`/`.warnings`), not rendered here. public var description: String { let reasonText = reason.hasSuffix(".") ? String(reason.dropLast()) : reason return path.isRoot ? "\(reasonText) at root of document" : "\(reasonText) at path: \(path.description)" } } }