1$id: https://openbmc-project.xyz/sdbusplus/events.schema.yaml
2$schema: https://json-schema.org/draft/2020-12/schema
3title: Event and error definitions
4type: object
5$defs:
6    base-event:
7        type: object
8        properties:
9            name:
10                type: string
11                description:
12                    An identifier for the event in UpperCamelCase; used as the
13                    class and Redfish Message ID.
14            deprecated:
15                type: string
16                pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$"
17                description:
18                    Indicates that the event is now deprecated and should not be
19                    created by any OpenBMC software, but is required to still
20                    exist for generation in the Redfish Message Registry. The
21                    version listed here should be the first version where the
22                    error is no longer used.
23            metadata:
24                type: array
25                items:
26                    type: object
27                    properties:
28                        name:
29                            type: string
30                            pattern: "^[A-Z_][A-Z0-9_]*$"
31                            description: The name of the metadata field.
32                        description:
33                            type: string
34                            description:
35                                A description of the field for use by
36                                developers.
37                        type:
38                            type: string
39                            pattern: "(string)|(size)|(u?int64)|(double)|(object_path)|(enum\\[.*\\])"
40                            description: The type of the metadata field.
41                        primary:
42                            type: boolean
43                            description:
44                                Set to true when the metadata field is expected
45                                to be part of the Redfish `MessageArgs` (and not
46                                only in the extended `DiagnosticData`).
47                    required:
48                        - name
49                        - description
50                        - type
51                minItems: 1
52        required:
53            - name
54    event:
55        type: object
56        allOf:
57            - $ref: "#/$defs/base-event"
58            - oneOf:
59                  - $ref: "#/$defs/redfish-messages"
60                  - $ref: "#/$defs/redfish-map"
61        unevaluatedProperties: false
62    error:
63        type: object
64        allOf:
65            - $ref: "#/$defs/base-event"
66            - oneOf:
67                  - $ref: "#/$defs/redfish-messages"
68                  - $ref: "#/$defs/redfish-map"
69        properties:
70            severity:
71                enum:
72                    - emergency
73                    - alert
74                    - critical
75                    - error
76                    - warning
77                    - notice
78                    - informational
79                    - debug
80                description: The severity using `syslog`-style nomenclature.
81            errno:
82                type: string
83                pattern: "^E[A-Z0-9]+$"
84                description: The errno used for this error.
85        required:
86            - severity
87            - errno
88        unevaluatedProperties: false
89    redfish-messages:
90        type: object
91        properties:
92            en:
93                $ref: "#/$defs/redfish-lang-message"
94                description: English message details.
95        required:
96            - en
97    redfish-lang-message:
98        type: object
99        description: The message details for any language.
100        properties:
101            description:
102                type: string
103                description:
104                    A developer-applicable description of the error reported.
105                    These form the "description" of the Redfish message.
106            message:
107                type: string
108                description:
109                    The end-user message, including placeholders for arguemnts.
110            resolution:
111                type: string
112                description: The end-user resolution.
113        required:
114            - message
115    redfish-map:
116        type: object
117        properties:
118            redfish-mapping:
119                type: string
120                pattern: "^[A-Z_][a-zA-Z0-9_]*(\\.[A-Z_][a-zA-Z0-9_]*)*$"
121                description: Used when a `sdbusplus` event should map to a
122                    specific Redfish Message rather than a generated one. This
123                    is useful when an internal error has an analog in a
124                    standardized registry.
125
126                    When specifying these, the version should be omitted.
127        required:
128            - redfish-mapping
129
130properties:
131    version:
132        type: string
133        pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$"
134        description:
135            The version of the file, which will be used as the Redfish Message
136            Registry version.
137    errors:
138        type: array
139        items:
140            $ref: "#/$defs/error"
141        minItems: 1
142    events:
143        type: array
144        items:
145            $ref: "#/$defs/event"
146        minItems: 1
147required:
148    - version
149