Runtime helpers called from compiler-emitted Broadway pipelines.
Centralizes the policy decisions the compiler doesn't need to know about
(whether to schema-validate, what to do on mismatch) so they can change
without re-running mix bloccs.compile.
Summary
Types
Reasons returned by validate_inbound/3 when validation fails.
Functions
Returns true when runtime inbound validation is enabled.
Validate a payload entering port against the schema declared on that
port in the node's manifest.
Types
Functions
@spec enabled?() :: boolean()
Returns true when runtime inbound validation is enabled.
@spec validate_inbound(Bloccs.Manifest.Node.t(), atom(), term()) :: :ok | {:error, validation_error()}
Validate a payload entering port against the schema declared on that
port in the node's manifest.
- Returns
:okif validation is disabled (config :bloccs, :validate_inbound, false), if the port has no schema, or if the schema isn't registered. - Returns
{:error, reason}if the payload doesn't match.
v0.1 only validates inbound. Outbound payloads are validated implicitly when they reach the next node's inbound check.