PureYAML/Sources/Validation/Validation.SourceReport.swift
Mihaela M c4f7f9dccc refactor(code-style): one top-level type per source file
Split the six files that declared multiple sibling types under one
namespace extension so each file declares exactly one top-level type:
the Tagged node component types (Node, NodeKind, Scalar, Sequence,
Mapping, Pair), the validation report types (Report, Source,
SourceReport, BatchReport), DiagnosticKind, TokenKind, ScannerFlowContext
kind, and the event-stream composer helpers. Public type names are
unchanged; the shared report-rendering helpers move from file-private to
internal so the split report types still reach them.

Make check-namespacing.sh namespace-aware: the previous column-anchored
scan was blind to types declared inside indented extension blocks, so it
passed while the rule was violated. It now counts direct members of a
PureYAML namespace extension and ignores nested types and private helpers.
2026-06-26 06:14:21 +02:00

24 lines
818 B
Swift

public extension PureYAML.Validation {
/// Validation result for one named source in a batch.
struct SourceReport: Equatable, Sendable {
public var name: String
public var report: Report
public var invalid: Bool
public init(name: String, report: Report, invalid: Bool) {
self.name = name
self.report = report
self.invalid = invalid
}
public func modelValue() -> PureYAML.Model.Value {
.mapping(.init([
.init(key: "name", value: .string(name)),
.init(key: "status", value: .string(invalid ? "invalid" : "valid")),
.init(key: "invalid", value: .bool(invalid)),
.init(key: "diagnostics", value: report.modelValue()),
]))
}
}
}