Schemas

Describe what a document is allowed to contain.

AEON keeps structure and validation separate. A document can stay readable and expressive, while AEOS defines what paths, value kinds, reference forms, and attribute payloads are acceptable.

That makes validation visible rather than hidden inside application code.

Schema Shape

A schema can express the expected structure directly.

The schema states required paths and the kinds of values they accept. A validator checks AES against that contract without changing the document itself.

aeos:schema = {
  id = "com.example.release"
  version = "1"
  rules = {
    $.document.title = {
      required = true
      type = "StringLiteral"
    }
    $.document.published = {
      type = "BooleanLiteral"
    }
    $.document.tags = {
      type_is = "list"
    }
    $.document.measurements[0] = {
      type = "NumberLiteral"
      attributes = {
        unit = {
          required = true
          type = "StringLiteral"
        }
      }
      closed_attributes = true
    }
  }
}

Validation Flow

The document and the schema remain separate artifacts.

The document remains ordinary AEON. Validation is a later step that confirms whether the document satisfies the contract you chose to apply.

document:object = {
  title:string = "Release notes"
  published:boolean = true
  tags:list = ["spec", "draft"]
  measurements:list = [@{unit:string = "cm"}:number = 3]
}

Validation Result

Failures stay explainable because the contract is explicit.

Because the schema is visible, validation failures can be explained in terms of the document itself: wrong value kind, missing path, unexpected binding, or missing attribute metadata. That is easier to reason about than hidden runtime assumptions.

document:object = {
  title:string = "Release notes"
  published:string = "yes"
  tags:list = ["spec", 42]
  measurements:list = [@{precision:number = 2}:number = 3]
}

What To Expand

Schemas and validation need a deeper reference page next.

The wiki now carries the fuller schema reference: constraints, indexed child paths, attribute-aware checks, result envelopes, diagnostic codes, and AEOS authority boundaries.

The formal specification and CTS remain the authority for normative validator behavior.