1// SPDX-License-Identifier: Apache-2.0
2
3// Schema lifecycle: experimental | stable | deprecated
4@status("stable")
5package gemara
6
7import "list"
8
9@go(gemara)
10
11// CapabilityCatalog describes a collection of system capabilities
12#CapabilityCatalog: {
13 #Catalog
14 metadata: type: "CapabilityCatalog"
15
16 // capabilities is a list of capabilities defined by this catalog
17 capabilities?: [#Capability, ...#Capability] @go(Capabilities)
18
19 if capabilities != _|_ {
20 _uniqueCapabilityIds: {for i, c in capabilities {(c.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, c in capabilities {
26 _groupValidation: "\(i)": _validGroupIds & list.Contains(c.group)
27 }
28 }
29}
30
31// Capability describes a system capability such as a feature, component or object.
32#Capability: {
33 // id allows this entry to be referenced by other elements
34 id: string
35
36 // title describes this capability at a glance
37 title: string
38
39 // description provides a detailed overview of this capability
40 description: string
41
42 // group references by id a catalog group that this capability belongs to
43 group: string @go(Group)
44}