Module aggregation

Module aggregation 

Source
Expand description

API aggregation (DW-061 spec, DP-09 runtime / #237).

Multi-upstream composition, JSONPath/CEL fragment shaping, per-fragment fail-open/closed (decision 10; section 5-Traffic).

§Constraint (decision 10, section 12.1)

The core dataplane never buffers full bodies to support composition – only this plugin’s own fragment transforms, with explicit size caps, touch bodies. Composition stays an extension cost, never a tax on the zero-buffering proxy path everything else uses.

§KrakenD-style aggregation

An aggregation endpoint composes a response from multiple upstreams. Each fragment specifies:

  • An upstream reference (service name + path)
  • A JSONPath expression to extract a fragment from the upstream response
  • A target field in the composed response
  • A fail-open/closed policy (fail-open = skip on error, fail-closed = return an error)

The aggregator fetches all fragments in parallel, shapes each, and combines them into a single JSON response.

§Runtime (DP-09, #237)

run_aggregation is the async runtime: it fetches all fragments in parallel via simple async TCP + HTTP/1.1, shapes each through JSONPath, and composes the result through the pure compose function. A ServiceResolver trait abstracts service-to-endpoint resolution so the runtime can be wired to the dataplane’s current generation balancers.

§Availability

The module is always compiled into the OSS build.

Structs§

AggregationSpec
An aggregation endpoint spec: composes a response from multiple upstream fragments.
FragmentSpec
A single fragment in an aggregation.
ResolvedEndpoint
A resolved upstream endpoint.

Enums§

ComposeResult
The result of composing fragments.
FailPolicy
The fail policy for a fragment.
FragmentResult
The result of fetching a fragment.

Traits§

ServiceResolver
A service resolver: maps a service name to an upstream endpoint. Implemented by the dataplane (which has the current snapshot’s services + upstreams + balancers).

Functions§

compose
Compose a response from fragment results.
extract_jsonpath
Extract a value from a JSON document using a simplified JSONPath expression.
make_error_fragment_result
Create an error fragment result (for when the upstream fetch fails).
make_fragment_result
Create a fragment result from a fetched upstream response.
run_aggregation
The async aggregation runtime: fetches all fragments, shapes each, and composes the result.
shape_fragment
Shape a fragment: extract the value using the JSONPath expression (if any), otherwise return the document as-is.
validate_spec
Validate an aggregation spec.