-
Notifications
You must be signed in to change notification settings - Fork 3
/
event_spec.json
218 lines (218 loc) · 5.43 KB
/
event_spec.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/product.schema.json",
"type": "object",
"definitions": {
"iddef": {
"type": "string",
"minLength": 1
},
"versiondef": {
"type": "string",
"minLength": 1
},
"timedef": {
"type": [
"string",
"null"
],
"format": "date-time",
"minLength": 1
},
"typedef": {
"type": "string",
"minLength": 1
},
"datadef": {
"type": [
"object",
"string",
"number",
"array",
"boolean",
"null"
]
},
"resourcedef": {
"type": "string",
"pattern": "([^/]+(/{2,}[^/]+)?)",
"minLength": 1
},
"valuetypedef": {
"enum": [
"enumeration",
"decimal64.3"
]
},
"ptp-sync-state": {
"enum": [
"LOCKED",
"HOLDOVER",
"FREERUN"
]
},
"os-clock-sync-state": {
"enum": [
"LOCKED",
"HOLDOVER",
"FREERUN"
]
},
"syncee-lock-state": {
"enum": [
"LOCKED",
"UNLOCKED"
]
},
"gnss-sync-state": {
"enum": [
"SYNCHRONIZED",
"ACQUIRING-SYNC",
"ANTENNA-DISCONNECTED",
"BOOTING",
"ANTENNA-SHORT_CIRCUIT"
]
},
"decimaldef": {
"type": "number"
},
"datatypedef": {
"enum": [
"notification",
"metric"
]
},
"valuedef": {
"type": [
"string",
"number",
"integer"
],
"oneOf": [
{
"if": {
"properties": {
"dataType": {
"const": "metric"
}
}
},
"then": {
"$ref": "#/definitions/decimaldef"
}
},
{
"if": {
"properties": {
"dataType": {
"const": "notification"
}
}
},
"then": {
"anyOf": [
{
"$ref": "#/definitions/ptp-sync-state"
},
{
"$ref": "#/definitions/os-clock-sync-state"
},
{
"$ref": "#/definitions/syncee-lock-state"
},
{
"$ref": "#/definitions/gnss-sync-state"
}
]
}
}
]
}
},
"properties": {
"id": {
"description": "Identifies the subscription and publisher.",
"$ref": "#/definitions/iddef",
"examples": [
"789be75d-7ac3-472e-bbbc-6d62878aad4a"
]
},
"type": {
"description": "Describes the type of cloud native events (CNE) related to the originating occurrence.",
"$ref": "#/definitions/typedef",
"examples": [
"com.github.pull_request.opened",
"com.example.object.deleted.v2"
]
},
"time": {
"description": "Timestamp of when the occurrence happened. Must adhere to RFC 3339.",
"$ref": "#/definitions/timedef",
"examples": [
"2018-04-05T17:31:00Z"
]
},
"data": {
"description": "Define events",
"type": "object",
"properties": {
"version": {
"description": "The version of the cloud native events (CNE) specification which the event uses.",
"$ref": "#/definitions/versiondef",
"examples": [
"1.0"
]
},
"values": {
"description": "Array of JSON objects defining the information for the event.",
"type": "array",
"minItems": 1,
"additionalItems": false,
"items": {
"type": "object",
"properties": {
"resource": {
"description": "Yang path to value specification .",
"$ref": "#/definitions/resourcedef",
"examples": [
"/sync/sync-status/sync-state"
]
},
"dataType": {
"description": "Defines the event types as either notification or metric",
"$ref": "#/definitions/datatypedef"
},
"valueType": {
"description": "The type format of the value property, either string or number format",
"$ref": "#/definitions/valuetypedef"
},
"value": {
"description": "The version of the cloud native events (CNE) specification which the event uses.",
"$ref": "#/definitions/valuedef"
}
},
"required": [
"resource",
"dataType",
"valueType",
"value"
],
"additionalProperties": false
}
}
},
"required": [
"version",
"values"
],
"additionalProperties": false
}
},
"required": [
"id",
"type",
"time",
"data"
],
"additionalProperties": false
}