Path: redb-route/redb.Route.JsonTransform/JsonTransformDefinition.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.JsonTransform/JsonTransformDefinition.cs ---- using redb.Route.Abstractions; using redb.Route.Core; using redb.Route.Definitions; namespace redb.Route.JsonTransform; /// /// The <transformJson> node: applies a JSONata specification to the JSON body. The /// specification is compiled at route build — a missing file or a syntax error fails Start() /// with the specification name — and cached by source. Declarative on purpose: the XML form reads /// and . /// public sealed class JsonTransformDefinition : ProcessorDefinition { /// Creates the node. public JsonTransformDefinition(TextSource specification, JsonTransformOutput output = JsonTransformOutput.String) { Specification = specification ?? throw new ArgumentNullException(nameof(specification)); Output = output; } /// Where the JSONata text comes from. public TextSource Specification { get; } /// JSON text or a JsonNode tree. public JsonTransformOutput Output { get; } /// public override IProcessor CreateProcessor(IRouteContext context) { // Context services first (UseJsonTransform), then the DI container (AddJsonTransform), then defaults. var options = context.GetService() ?? context.GetServiceProvider()?.GetService(typeof(JsonTransformOptions)) as JsonTransformOptions ?? new JsonTransformOptions(); // Same lookup as the template step and the validator: context resolver, then base directory. // A miss stays a specification failure, not an IO one — the step promises one exception type. TextSource specification; try { specification = ResourceResolution.Locate(context, Specification, options.BaseDirectory, "JSONata specification"); } catch (FileNotFoundException ex) { throw new JsonTransformCompilationException(Specification.Name, ex.Message, ex); } var compiled = JsonTransformEngine.Compile(specification, options); return new JsonTransformProcessor(compiled, Output, options); } }