@@ -3,32 +3,48 @@ title: "Metadata"
33draft : false
44---
55
6- Metadata in RIDDL provides supplementary information about definitions that
7- doesn't affect the core semantics but aids documentation, organization, and
8- tooling.
6+ Metadata in RIDDL provides supplementary information about
7+ definitions—documentation, terminology, attribution, and
8+ implementation hints—without affecting core semantics. All metadata
9+ lives in a ` with { } ` block that follows the definition's closing
10+ brace.
911
10- ## Common Metadata
12+ ## Placement
1113
12- All definitions support these metadata elements :
14+ Metadata appears ** after ** a definition's body, not inside it :
1315
14- ### Brief Description
16+ ``` riddl
17+ context OrderManagement is {
18+ // body definitions go here (entities, types, handlers, etc.)
19+ ???
20+ } with {
21+ // metadata goes here
22+ briefly "Manages the order lifecycle"
23+ term Fulfillment is {
24+ |The complete process of receiving, processing, and
25+ |delivering an order to the customer.
26+ }
27+ option is technology("Kafka")
28+ }
29+ ```
30+
31+ ## Brief Description
1532
16- A short, one-line description using ` briefly ` :
33+ A short, one-line summary using ` briefly ` :
1734
1835``` riddl
19- entity Customer is {
36+ entity Customer is { ??? } with {
2037 briefly "A person or organization that purchases products"
21- // ...
2238}
2339```
2440
25- ### Extended Description
41+ ## Extended Description
2642
27- Longer documentation using ` described by ` (or ` described as ` , ` explained by ` ,
28- ` explained as ` ):
43+ Longer documentation using ` described by ` (or ` described as ` ,
44+ ` explained by ` , ` explained as` ):
2945
3046``` riddl
31- entity Customer is {
47+ entity Customer is { ??? } with {
3248 described by {
3349 |Customers are the primary actors in our e-commerce system.
3450 |They can browse products, place orders, and manage their
@@ -37,52 +53,116 @@ entity Customer is {
3753}
3854```
3955
40- The ` | ` prefix indicates lines of documentation text (Markdown format).
56+ The ` | ` prefix indicates lines of documentation text in Markdown
57+ format.
4158
42- ### Terms
59+ ## Terms
4360
44- Domain-specific terminology with definitions:
61+ Domain-specific terminology defined as glossary entries. The syntax
62+ is ` term ` * identifier* ` is ` * doc_block* :
4563
4664``` riddl
4765domain ECommerce is {
48- term "SKU" is described by "Stock Keeping Unit - unique product identifier"
49- term "Cart" is described by "Temporary collection of items before checkout"
66+ context Catalog is {
67+ ???
68+ } with {
69+ term Listing is {
70+ |A product's presence in the catalog, including its
71+ |description, images, pricing, and availability.
72+ }
73+ }
74+ } with {
75+ term SKU is {
76+ |Stock Keeping Unit—a unique identifier for a specific
77+ |product variant, including size, color, and other
78+ |attributes.
79+ }
5080}
5181```
5282
53- ### Authors
83+ ## Options
5484
55- Attribution for definitions:
85+ Options are instructions to translators about how a definition
86+ should be implemented or interpreted. The syntax is ` option is `
87+ * option_name* with optional string arguments:
5688
5789``` riddl
58- author Reid is {
59- name "Reid Spencer"
60- email "reid@example.com"
90+ entity Order is {
91+ ???
92+ } with {
93+ option is event-sourced
94+ option is aggregate
95+ option is technology("Akka")
96+ option is kind("core")
6197}
98+ ```
99+
100+ See [ Options] ( option.md ) for the full list of available options
101+ per definition type.
102+
103+ ## Author Definitions vs. Author References
104+
105+ RIDDL distinguishes between ** author definitions** and ** author
106+ references** . They serve different purposes and appear in different
107+ places.
108+
109+ ### Author Definitions (Body)
110+
111+ Author definitions declare who created or maintains a model. They
112+ can ** only** appear in the body of a ** Module** or ** Domain** —not
113+ in contexts, entities, or other definitions:
114+
115+ ``` riddl
116+ domain ECommerce is {
117+ author Reid is {
118+ name is "Reid Spencer"
119+ email is "reid@ossum.com"
120+ }
62121
63- domain MyDomain by author Reid is { ... }
122+ context Catalog is { ??? }
123+ }
64124```
65125
66- ## Options
126+ See [ Author ] ( author.md ) for full details.
67127
68- Options modify the behavior of definitions. Common options include:
128+ ### Author References (Metadata)
69129
70- - ` technology("x") ` : Implementation technology hints
71- - ` kind("x") ` : Classification of the definition
72- - ` css("x") ` : Styling hints for documentation
73- - ` faicon("x") ` : Font Awesome icon for documentation
130+ Author references use ` by author ` to associate an existing author
131+ definition with any definition's metadata:
74132
75133``` riddl
76- context OrderManagement is {
77- option technology("Akka")
78- option kind("core")
79- // ...
134+ domain ECommerce is {
135+ author Reid is {
136+ name is "Reid Spencer"
137+ email is "reid@ossum.com"
138+ }
139+
140+ context Catalog is {
141+ ???
142+ } with {
143+ by author Reid
144+ }
145+ }
146+ ```
147+
148+ ## Attachments
149+
150+ Attachments associate external files (diagrams, spreadsheets,
151+ images) with a definition:
152+
153+ ``` riddl
154+ entity Order is {
155+ ???
156+ } with {
157+ attachment StateChart is "diagrams/order-states.png"
158+ as "image/png"
80159}
81160```
82161
83162## Occurs In
84163
85- Metadata can appear in any definition, including:
164+ Metadata (` with { } ` blocks) can appear on any definition,
165+ including:
86166
87167* [ Domains] ( domain.md )
88168* [ Contexts] ( context.md )
@@ -92,8 +172,12 @@ Metadata can appear in any definition, including:
92172
93173## Contains
94174
95- Metadata does not contain other definitions; it contains :
175+ Metadata blocks contain:
96176
97- * Literal strings (descriptions, term definitions)
98- * Options with parameters
99- * Author references
177+ * Brief descriptions (` briefly ` )
178+ * Extended descriptions (` described by ` )
179+ * [ Terms] ( term.md ) — glossary entries
180+ * [ Options] ( option.md ) — translator instructions
181+ * Author references (` by author ` )
182+ * Attachments
183+ * Comments
0 commit comments