Skip to main content

Module contract

Module contract 

Source
Available on crate feature contract only.
Expand description

Data contracts (issue #204): a declarative, versioned schema + semantic contract for a pipeline’s output — required fields, types, nullability, enum sets, regex patterns, numeric/length bounds — enforced per page after transforms and quality checks and before the sink write. Breaches fail, quarantine (via the DLQ), or warn per the contract-level policy.

Pure evaluation; the pipeline wires DLQ routing and metrics in run_stream / instrumented_apply_contract.

Re-exports§

pub use compile::CompiledContract;
pub use compile::CompiledField;
pub use config::ContractFieldType;
pub use config::ContractSpec;
pub use config::FieldContract;
pub use config::OnBreach;
pub use export::OPENLINEAGE_SCHEMA_FACET_URL;
pub use export::to_json_schema;
pub use export::to_openlineage_facet;

Modules§

compile
Compile a ContractSpec into a CompiledContract: validate the version, field-name uniqueness, per-type constraint compatibility, and bounds, and compile regexes/enum sets once so the per-record pass is cheap. Failures surface as FaucetError::Config at config-load time, never mid-run.
config
Config-shaped types for the data-contract layer (issue #204). Pure declarations — validation and compilation live in compile.rs, evaluation in the module root.
export
Machine-readable contract exports: JSON Schema and an OpenLineage SchemaDatasetFacet. Pure functions over a ContractSpec — no I/O. Used by faucet contract --export …; available to library callers too.

Structs§

ContractOutcome
Result of applying the contract pass to one page.
ContractViolation
One observed contract breach.
ViolatingRecord
A record removed from the page by a quarantine breach, destined for the DLQ.

Functions§

apply_contract
Apply the contract to one page. Pure: no metrics, no DLQ I/O.