Validation
How extracted field rules, Acore constraints, runtime validation, and domain invariants differ.
AxiomCore has several validation layers. They are related but not interchangeable.
| Layer | Purpose | Enforcement boundary |
|---|---|---|
| Acore type/constraint | Validate authored values during evaluation | Compiler/evaluator |
| Extracted model validation | Preserve supported source-schema constraints | Contract build and supported runtime paths |
Endpoint validate | Enable/override response/request validation intent | Selected runtime path |
| Domain invariant | Reviewable business-semantic evidence | Signed manifest/tooling; not arbitrary code execution |
| Security rule | Report/gate declared coverage and unsafe combinations | Analyzer/build/release according to mode |
Field validation
ModelField.validate carries normalized structured rules. Extractors normally
produce it from supported source-framework metadata:
models {
["User"] = ModelDef {
name = "User"
fields = Mapping {
["email"] = ModelField {
name = "email"
typeRef = TypeRefPrimitive { kind = "string" }
validate = {
type = "string"
min = 3
max = 254
format = "email"
}
}
}
}
}No validation block should serialize as an ambient empty object; a field with
no normalized rules uses null.
Type constraints
sampleRate: Float(this >= 0.0 && this <= 1.0) = 0.25These constraints validate Acore configuration values during evaluation.
Domain invariants
invariants = Invariants {
["nonNegativeTotal"] = DomainInvariant {
scope = Entities.order
expression = "total_cents >= 0"
fields = Listing { "total_cents" }
}
}Invariant expressions and bounded rule objects are signed evidence for review, generation, and impact analysis. The compiler does not execute arbitrary business expressions against production data.
Failure behavior
Invalid authored types or structural references stop a build. Runtime payload failure is reported through the selected SDK/runtime error state. Exact error transport differs by target; test your consuming framework and avoid assuming one UI error shape across all clients.