README

Wchwch777/moonverity/core does not have a README file

#
DataRow

type DataRow = Map[String, String]

Mutable linked hash map that maintains the order of insertion, not thread safe.

Example

test {
let map = { 3: "three", 8: "eight", 1: "one" }
@test.assert_eq(map.get(2), None)
@test.assert_eq(map.get(3), Some("three"))
map.set(3, "updated")
@test.assert_eq(map.get(3), Some("updated"))
}

#
BenchmarkCase

pub(all) struct BenchmarkCase {
name : String
contract : Contract
rows : Array[Map[String, String]]
expected_passed : Bool
} derive(Eq,
Debug
)

One reproducible validation case for a benchmark or acceptance fixture.

#
BenchmarkCaseResult

pub(all) struct BenchmarkCaseResult {
name : String
expected_passed : Bool
actual_passed : Bool
consistent : Bool
row_count : Int
failure_count : Int
warning_count : Int
quality : QualityScore
} derive(Eq,
Debug
)

The observed result of one benchmark case.

#
BenchmarkSuite

pub(all) struct BenchmarkSuite {
passed : Bool
case_count : Int
cases : Array[BenchmarkCaseResult]
failed_cases : Array[String]
} derive(Eq,
Debug
)

Aggregated benchmark results. passed means every expectation matched.

#
ColumnProfile

pub(all) struct ColumnProfile {
name : String
non_empty_count : Int
empty_count : Int
distinct_values : Array[String]
min_length : Int
max_length : Int
total_length : Int
} derive(Eq,
Debug
)

#
ComparisonOp

pub(all) enum ComparisonOp {
GreaterOrEqual
GreaterThan
LessOrEqual
LessThan
Equal
} derive(Eq,
Debug
)

#
Contract

pub(all) struct Contract {
name : String
version : String
fields : Array[FieldSpec]
rules : Array[Rule]
} derive(Eq,
Debug
)

#
ContractDiff

pub(all) struct ContractDiff {
added_fields : Array[String]
removed_fields : Array[String]
changed_fields : Array[String]
added_rules : Array[String]
removed_rules : Array[String]
changed_rules : Array[String]
} derive(Eq,
Debug
)

#
ContractIssue

pub(all) struct ContractIssue {
code : String
message : String
} derive(Eq,
Debug
)

#
ContractReferences

pub(all) struct ContractReferences {
referenced_fields : Array[String]
missing_fields : Array[String]
unused_fields : Array[String]
} derive(Eq,
Debug
)

The field references used by a contract's rules.

#
ContractStats

pub(all) struct ContractStats {
field_count : Int
required_field_count : Int
typed_field_count : Int
rule_count : Int
error_rule_count : Int
warning_rule_count : Int
} derive(Eq,
Debug
)

#
DatasetProfile

pub(all) struct DatasetProfile {
row_count : Int
columns : Array[ColumnProfile]
} derive(Eq,
Debug
)

#
FieldSpec

pub(all) struct FieldSpec {
name : String
kind : FieldType
required : Bool
nullable : Bool
allowed_values : Array[String]
min_int : Int?
max_int : Int?
pattern : String?
description : String
} derive(Eq,
Debug
)

#
FieldType

pub(all) enum FieldType {
String
Int
Bool
Date
} derive(Eq,
Debug
)

#
QualityScore

pub(all) struct QualityScore {
total_cells : Int
non_empty_cells : Int
completeness_percent : Int
error_row_count : Int
warning_row_count : Int
score_percent : Int
grade : String
} derive(Eq,
Debug
)

A diagnostic quality score derived from profile completeness and validation rows. The score is a dashboard signal, not a replacement for the contract gate.

#
Rule

pub(all) enum Rule {
Unique(fields~ : Array[String], severity~ : Severity, message~ : String)
Completeness(field~ : String, min_percent~ : Int, severity~ : Severity, message~ : String)
Enum(field~ : String, allowed_values~ : Array[String], severity~ : Severity, message~ : String)
IntRange(field~ : String, min~ : Int, max~ : Int, severity~ : Severity, message~ : String)
CompareInts(left~ : String, op~ : ComparisonOp, right~ : String, severity~ : Severity, message~ : String)
PatternMatch(field~ : String, pattern~ : String, severity~ : Severity, message~ : String)
StringLength(field~ : String, min~ : Int, max~ : Int, severity~ : Severity, message~ : String)
DistinctCount(field~ : String, min~ : Int, max~ : Int, severity~ : Severity, message~ : String)
RequiredIf(condition_field~ : String, condition_value~ : String, field~ : String, severity~ : Severity, message~ : String)
RowCount(min~ : Int?, max~ : Int?, severity~ : Severity, message~ : String)
} derive(Eq,
Debug
)

#
RuleResult

pub(all) struct RuleResult {
name : String
severity : Severity
passed : Bool
failure_rows : Array[Int]
message : String
} derive(Eq,
Debug
)

#
RuleSummary

pub(all) struct RuleSummary {
name : String
severity : Severity
passed : Bool
failure_count : Int
} derive(Eq,
Debug
)

#
Severity

pub(all) enum Severity {
Error
Warning
} derive(Eq,
Debug
)

#
ValidationReport

pub(all) struct ValidationReport {
dataset_name : String
row_count : Int
passed : Bool
failure_count : Int
warning_count : Int
rule_results : Array[RuleResult]
} derive(Eq,
Debug
)

#
ValidationSummary

pub(all) struct ValidationSummary {
status : String
error_rule_count : Int
warning_rule_count : Int
failed_rule_count : Int
affected_rows : Array[Int]
} derive(Eq,
Debug
)

#
analyze_contract_references

fn analyze_contract_references(contract : Contract) -> ContractReferences

Analyze rule-to-field dependencies before executing a contract.

#
contract_field_names

fn contract_field_names(contract : Contract) -> Array[String]

#
contract_rule_names

fn contract_rule_names(contract : Contract) -> Array[String]

#
contract_stats

fn contract_stats(contract : Contract) -> ContractStats

Return stable complexity indicators for documentation and review tooling.

#
diff_contracts

fn diff_contracts(before : Contract, after : Contract) -> ContractDiff

#
field_spec

fn field_spec(name : String, kind? : FieldType, required? : Bool, nullable? : Bool, allowed_values? : Array[String], min_int? : Int, max_int? : Int, pattern? : String, description? : String) -> FieldSpec

#
has_field

fn has_field(contract : Contract, name : String) -> Bool

#
inspect_contract

fn inspect_contract(contract : Contract) -> Array[ContractIssue]

Inspect a contract before running it so configuration errors are explicit.

#
normalize_contract

fn normalize_contract(contract : Contract) -> Contract

Normalize user-authored contract metadata without changing its intent.

#
parse_contract_json

fn parse_contract_json(source : String) -> Contract

#
profile_rows

fn profile_rows(rows : Array[Map[String, String]]) -> DatasetProfile

#
quality_score

fn quality_score(profile : DatasetProfile, report : ValidationReport) -> QualityScore

Calculate a deterministic score for dashboards and benchmark reports.

#
row_of

fn row_of(entries : Array[(String, String)]) -> Map[String, String]

#
rule_field_references

fn rule_field_references(rule : Rule) -> Array[String]

Return the fields a rule reads, preserving the rule's declaration order.

#
rule_summaries

fn rule_summaries(report : ValidationReport) -> Array[RuleSummary]

Return one compact summary item for each validation rule.

#
run_benchmark_suite

fn run_benchmark_suite(cases : Array[BenchmarkCase]) -> BenchmarkSuite

Run a deterministic suite without wall-clock timing or platform noise.

#
summarize_report

fn summarize_report(report : ValidationReport) -> ValidationSummary

Summarize a report for dashboards and CI annotations.

#
validate_rows

fn validate_rows(contract : Contract, rows : Array[Map[String, String]]) -> ValidationReport

#
validate_rows_with_schema

fn validate_rows_with_schema(contract : Contract, rows : Array[Map[String, String]]) -> ValidationReport

Validate field declarations in addition to the explicit contract rules.

This opt-in entry point keeps validate_rows compatible with the original rule-only API while making the field metadata executable for applications that want a complete data-contract gate.

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io