Context
Syntax
context <Name> { <elements>}A context is the top-level organizational unit. It maps to a bounded context in Domain-Driven Design. A context contains type declarations, commands, events, and deciders.
Rules
<Name>must start with an uppercase letter.- A
.dddfile may contain multiple context blocks. - Elements within a context can reference each other by name.
- Cross-context references are not yet supported.
Example
context Ordering { type CartId = String type CustomerId = String
command OpenCart { cartId: CartId customerId: CustomerId }
event CartOpened { cartId: CartId customerId: CustomerId }
decider ShoppingCart { commands: OpenCart events: CartOpened state: Empty | Active
initial: Empty terminal: Active
decide(OpenCart, Empty) -> [CartOpened] evolve(Empty, CartOpened) -> Active }}