Skip to content

aggregate

Container-based consistency unit inside a Bounded Context. See Concepts: Aggregate.

Fields

Field Required Description
apiVersion yes schema.esdm.io/core/v1
kind yes aggregate
name yes The Aggregate name.
scope yes scope.boundedContext reference.
identifiedBy yes The identification strategy.
state yes JSON Schema describing the Aggregate's state.
invariants no Named rules that must always hold.
description no Free-form prose.
metadata no Non-semantic labels and annotations.

identifiedBy

A discriminated object with source plus a strategy-specific field.

source Sibling field Description
state field Identifier comes from a named field of state.
static value Identifier is a fixed string.
generated generator Identifier is produced by a named strategy (uuid, ulid, snowflake, cuid, nanoid, ...).

invariants[]

Named rules. Each entry is { name, rule }, where rule is the prose statement of the constraint.

Example

apiVersion: schema.esdm.io/core/v1
kind: aggregate
name: round
scope:
  domain: golf-club-management
  boundedContext: round-play
identifiedBy:
  source: state
  field: roundId
state:
  type: object
  properties:
    roundId: { type: string }
    status: { type: string, enum: [in-progress, completed] }
  required: [roundId, status]
invariants:
  - name: status-is-terminal
    rule: A round in status `completed` cannot transition back to `in-progress`.