1// SPDX-License-Identifier: Apache-2.0
2
3// Schema lifecycle: experimental | stable | deprecated
4@status("stable")
5
6package gemara
7
8import "time"
9
10@go(gemara)
11
12// Datetime represents an ISO 8601 formatted datetime string
13#Datetime: time.Format("2006-01-02T15:04:05Z07:00") @go(Datetime,format="date-time")
14
15// Group represents a classification or grouping that can be used in different contexts with semantic meaning derived from its usage
16#Group: {
17 // id allows this entry to be referenced by other elements
18 id: string
19
20 // title describes the purpose of this group at a glance
21 title: string
22
23 // description explains the significance and traits of entries to this group
24 description: string
25}
26
27// Metadata represents common metadata fields shared across all layers
28#Metadata: {
29 // id allows this entry to be referenced by other elements
30 id: string
31
32 // type identifies the kind of Gemara artifact for unambiguous parsing
33 type: #ArtifactType
34
35 // gemara-version declares which version of the Gemara specification this artifact conforms to
36 "gemara-version": string @go(GemaraVersion) @yaml("gemara-version")
37
38 // version is the version identifier of this artifact
39 version?: string
40
41 // date is the publication or effective date of this artifact
42 date?: #Datetime @go(Date)
43
44 // description provides a high-level summary of the artifact's purpose and scope
45 description: string
46
47 // author is the person or group primarily responsible for this artifact
48 author: #Actor
49
50 // mapping-references is a list of external documents referenced within this artifact
51 MR="mapping-references"?: [#MappingReference, ...#MappingReference] @go(MappingReferences) @yaml("mapping-references,omitempty")
52
53 // applicability-groups is a list of groups used to classify within this artifact to specify scope
54 AG="applicability-groups"?: [#Group, ...#Group] @go(ApplicabilityGroups) @yaml("applicability-groups,omitempty")
55
56 // draft indicates whether this artifact is a pre-release version; open to modification
57 draft?: bool
58
59 // lexicon is a URI pointing to a controlled vocabulary or glossary relevant to this artifact
60 lexicon?: #ArtifactMapping @go(Lexicon,optional=nillable)
61
62 if MR != _|_ {
63 _uniqueRefIds: {for i, r in MR {(r.id): i}}
64 }
65 if AG != _|_ {
66 _uniqueGroupsIds: {for i, c in AG {(c.id): i}}
67 }
68}
69
70// ArtifactType identifies the kind of Gemara artifact for unambiguous parsing
71#ArtifactType: "CapabilityCatalog" | "ControlCatalog" | "GuidanceCatalog" | "ThreatCatalog" | "RiskCatalog" | "Policy" | "MappingDocument" | "Lexicon" | "EvaluationLog" | "EnforcementLog" | "VectorCatalog" | "PrincipleCatalog" | "AuditLog" @go(-)