Path: redb-route/redb.Route.Xml/Packaging/IPackageCheck.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Xml/Packaging/IPackageCheck.cs ---- using System.Xml; using System.Xml.Linq; namespace redb.Route.Xml.Packaging; /// /// A check a package of the route format runs over a route project at check and pack time, beside the /// gate's own. A connector or data format implements it where its exact rules need its own code (the xmljson format /// compiles the schema with its own reader and walks it). With --bin the tool creates every public, non-abstract /// implementation with a parameterless constructor in the redb.Route.*.dll of the build output, the same way it /// finds element contributions; without --bin none runs. /// public interface IPackageCheck { /// Examines the project and reports its findings through . void Check(PackageCheckContext context); } /// One route document of the project, loaded with line information. /// The path the findings name, relative to the project. /// The document; every node carries its line and position. public sealed record PackageDocument(string File, XDocument Document); /// What a sees of the project, and where it reports. public sealed class PackageCheckContext { private readonly List _findings; internal PackageCheckContext(string projectDirectory, IReadOnlyList documents, List findings) { ProjectDirectory = projectDirectory; Documents = documents; _findings = findings; } /// The project directory. public string ProjectDirectory { get; } /// The route documents of the project. public IReadOnlyList Documents { get; } /// /// The full path of a resource a route refers to, held to what the package ships (resources/), as the gate /// holds its own resource references; null with the reason when it is missing or outside resources/. /// /// The reference as written (order.xsd, resources/schemas/order.xsd). /// The reason, worded to follow the reference (is not under 'resources/'). public string? Resource(string reference, out string? problem) { ArgumentNullException.ThrowIfNull(reference); return RoutePackage.PackagedResource(ProjectDirectory, reference, out problem); } /// An error at a node of a document: the package does not build. public void Error(PackageDocument document, XObject at, string message) => Add(true, document, at, message); /// A warning at a node of a document. public void Warning(PackageDocument document, XObject at, string message) => Add(false, document, at, message); private void Add(bool error, PackageDocument document, XObject at, string message) { ArgumentNullException.ThrowIfNull(document); ArgumentNullException.ThrowIfNull(at); ArgumentException.ThrowIfNullOrWhiteSpace(message); var line = (IXmlLineInfo)at; _findings.Add(new PackageFinding(error, $"{document.File}({line.LineNumber},{line.LinePosition})", message)); } }