1// SPDX-License-Identifier: Apache-2.0
2
3// Schema lifecycle: experimental | stable | deprecated
4@status("experimental")
5package gemara
6
7import "list"
8
9@go(gemara)
10
11// PrincipleCatalog describes a set of related principles and relevant metadata
12#PrincipleCatalog: {
13 #Catalog
14 metadata: type: "PrincipleCatalog"
15
16 // principles is a list of unique principles defined by this catalog
17 principles?: [#Principle, ...#Principle] @go(Principles)
18
19 if principles != _|_ {
20 _uniquePrinciplesIds: {for i, p in principles {(p.id): i}}
21 groups: [#Group, ...#Group]
22 let _validGroupIds = [for g in groups {g.id}]
23
24 // Unify the valid ID list with a list.Contains constraint to require each entry's value exists
25 for i, p in principles {
26 _groupValidation: "\(i)": _validGroupIds & list.Contains(p.group)
27 }
28 }
29}
30
31// Principle represents a foundational value or tenet that guides governance, design, and operational decisions
32#Principle: {
33 // id allows this entry to be referenced by other elements
34 id: string
35
36 // title describes the principle at a glance
37 title: string
38
39 // description explains the principle and its expected outcomes
40 description: string
41
42 // group references by id a catalog group that this principle belongs to
43 group: string @go(Group)
44
45 // rationale provides the context for this principle
46 rationale?: string
47}