lightspeed/pipeline/quality
Data-quality and schema-evolution contracts for ETL pipeline boundaries.
Types
Boundary field type.
pub type FieldType {
StringType
IntType
BoolType
}
Constructors
-
StringType -
IntType -
BoolType
Validation error for one payload/schema pair.
pub type ValidationError {
InvalidSchema(reason: String)
MissingField(field: String)
UnexpectedField(field: String)
TypeMismatch(
field: String,
expected: FieldType,
actual: String,
)
}
Constructors
-
InvalidSchema(reason: String) -
MissingField(field: String) -
UnexpectedField(field: String) -
TypeMismatch(field: String, expected: FieldType, actual: String)
Validation result.
pub type ValidationResult {
ValidationPassed(normalized: List(BoundaryValue))
ValidationFailed(errors: List(ValidationError))
}
Constructors
-
ValidationPassed(normalized: List(BoundaryValue)) -
ValidationFailed(errors: List(ValidationError))
Typed value at one boundary.
pub type Value {
StringValue(String)
IntValue(Int)
BoolValue(Bool)
NullValue
}
Constructors
-
StringValue(String) -
IntValue(Int) -
BoolValue(Bool) -
NullValue
Values
pub fn bool_value(name: String, value: Bool) -> BoundaryValue
Build one named boolean value.
pub fn check_compatibility(
previous: Schema,
next: Schema,
) -> Result(Nil, String)
Check whether next is compatibility-safe relative to previous.
pub fn int_value(name: String, value: Int) -> BoundaryValue
Build one named integer value.
pub fn schema(
name: String,
version: Int,
fields: List(Field),
) -> Schema
Build one schema contract.
pub fn string_value(name: String, value: String) -> BoundaryValue
Build one named string value.
pub fn validate(
schema: Schema,
payload: List(BoundaryValue),
) -> ValidationResult
Validate one payload against one schema contract.
pub fn validation_error_label(error: ValidationError) -> String
Validation-error label.
pub fn validation_result_label(
result: ValidationResult,
) -> String
Validation-result label.