AxiomCore
Acore Language

Validation

How extracted field rules, Acore constraints, runtime validation, and domain invariants differ.

AxiomCore has several validation layers. They are related but not interchangeable.

LayerPurposeEnforcement boundary
Acore type/constraintValidate authored values during evaluationCompiler/evaluator
Extracted model validationPreserve supported source-schema constraintsContract build and supported runtime paths
Endpoint validateEnable/override response/request validation intentSelected runtime path
Domain invariantReviewable business-semantic evidenceSigned manifest/tooling; not arbitrary code execution
Security ruleReport/gate declared coverage and unsafe combinationsAnalyzer/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.25

These 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.

On this page