Skip to content

Commit 91521fe

Browse files
reidspencerclaude
andcommitted
Complete incomplete sections in RIDDL language reference
- Add Branches section describing container definitions - Add Processors section describing message-processing definitions - Complete Data Types section with full type system documentation - Complete Domain Hierarchy description Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c6ec9ef commit 91521fe

1 file changed

Lines changed: 67 additions & 4 deletions

File tree

docs/riddl/references/language-reference.md

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,38 @@ RIDDL emphasizes:
3131
Everything that has a name and can have metadata is known as a Definition in RIDDL.
3232

3333
### Branches
34-
Every
34+
Branch definitions are containers that hold other definitions. They form the
35+
hierarchical structure of a RIDDL model:
36+
- **Root**: The implicit top-level container (not explicitly defined)
37+
- **Module**: Organizes root content for large models
38+
- **Domain**: Contains bounded contexts and domain-wide definitions
39+
- **Context**: Contains entities, repositories, sagas, and other processors
40+
- **Entity**: Contains states, handlers, functions, and message types
41+
- **Epic**: Contains use cases describing user interactions
42+
- **Saga**: Contains steps for multi-step processes with compensation
43+
3544
### Processors
3645

46+
Processors are definitions that can receive and process messages. They form the
47+
active components of a RIDDL model:
48+
49+
- **Entity**: Stateful processor with commands, events, states, and handlers.
50+
Entities are the primary business objects that maintain state and respond to
51+
commands.
52+
- **Adaptor**: Translates messages between contexts. Defined with a direction
53+
(`from` or `to`) relative to a context.
54+
- **Repository**: Handles persistence of data. Contains schemas and handlers
55+
for storage operations.
56+
- **Projector**: Projects events to a repository, often transforming or
57+
aggregating data for read models (CQRS pattern).
58+
- **Streamlet**: Processes streaming data. Subtypes include `source`, `sink`,
59+
`flow`, `merge`, `split`, `router`, and `void`.
60+
- **Saga**: Orchestrates multi-step processes with compensation logic for
61+
failure recovery.
62+
63+
All processors can contain handlers, functions, types, and other processor-
64+
specific definitions.
65+
3766
### Domain Hierarchy
3867

3968
RIDDL models are organized hierarchically:
@@ -55,12 +84,46 @@ RIDDL models are organized hierarchically:
5584
- **Saga**: A component that defines the orchestration of multi-step atomic process with
5685
compensation actions to undo the process when errors arise.
5786
- **Epic**: A collection of use cases to show an expected usage pattern
58-
- **Case**: A Specific user interaction flow
87+
- **Case**: A specific user interaction flow
5988

60-
The hierarchy
89+
The hierarchy follows strict containment rules: Root → Module/Domain → Context →
90+
Entity/Repository/Saga/Streamlet → States/Handlers/Functions. Each level can
91+
only contain specific definition types as detailed in the Containment Rules
92+
section below.
6193

6294
### Data Types
63-
Riddl has a rich
95+
96+
RIDDL has a rich type system supporting both simple and complex data structures:
97+
98+
**Predefined Types:**
99+
- **Strings**: `String`, `String(min,max)` with length constraints
100+
- **Numbers**: `Integer`, `Natural`, `Whole`, `Real`, `Number`, `Decimal(w,f)`
101+
- **Boolean**: `Boolean`
102+
- **Temporal**: `Date`, `Time`, `DateTime`, `TimeStamp`, `Duration`,
103+
`ZonedDateTime(zone)`
104+
- **Identifiers**: `UUID`, `UserId`, `Id(entity path)`
105+
- **Other**: `URL`, `URL(scheme)`, `Currency(code)`, `Location`, `Nothing`,
106+
`Abstract`
107+
- **Physical**: `Length`, `Mass`, `Current`, `Temperature`, `Luminosity`, `Mole`
108+
109+
**Pattern Types:**
110+
- `Pattern("regex")` - String matching a regular expression
111+
112+
**Compound Types:**
113+
- **Aggregation**: `{ field1 is Type1, field2 is Type2 }` - Named field collections
114+
- **Alternation**: `one of { TypeA, TypeB, TypeC }` - Union/sum types
115+
- **Enumeration**: `any of { Value1, Value2, Value3 }` - Enumerated values
116+
117+
**Collection Types:**
118+
- **Sequence**: `sequence of Type` or `many Type`
119+
- **Set**: `set of Type`
120+
- **Mapping**: `mapping from KeyType to ValueType`
121+
- **Optional**: `optional Type` or `Type?`
122+
123+
**Special Types:**
124+
- **Entity Reference**: `reference to entity Path`
125+
- **Unique ID**: `Id(entity Path)` - Type-safe entity identifier
126+
64127
### Basic Syntax Elements
65128

66129
1. **Readability Words**: Optional words that improve human readability of a model

0 commit comments

Comments
 (0)