-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathenvelope.schema.json
More file actions
132 lines (132 loc) · 3.4 KB
/
envelope.schema.json
File metadata and controls
132 lines (132 loc) · 3.4 KB
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
{
"$id": "https://gabp.dev/schema/1.0/envelope.schema.json",
"$schema": "https://json-schema.org/draft-07/schema#",
"title": "GABP Envelope 1.0",
"description": "Base envelope schema for all GABP messages",
"type": "object",
"oneOf": [
{ "$ref": "#/$defs/request" },
{ "$ref": "#/$defs/response" },
{ "$ref": "#/$defs/event" }
],
"$defs": {
"uuid": {
"type": "string",
"format": "uuid",
"description": "UUID v4 identifier"
},
"error": {
"type": "object",
"required": ["code", "message"],
"properties": {
"code": {
"type": "integer",
"description": "Numeric error code"
},
"message": {
"type": "string",
"minLength": 1,
"description": "Human-readable error message"
},
"data": {
"description": "Additional error-specific data"
}
},
"additionalProperties": false
},
"request": {
"type": "object",
"required": ["v", "id", "type", "method"],
"properties": {
"v": {
"const": "gabp/1",
"description": "Protocol version identifier"
},
"id": {
"$ref": "#/$defs/uuid",
"description": "Unique request identifier"
},
"type": {
"const": "request",
"description": "Message type"
},
"method": {
"type": "string",
"pattern": "^[a-z]+(/[a-z]+)+$",
"description": "Method name to invoke"
},
"params": {
"type": "object",
"default": {},
"description": "Method parameters"
}
},
"additionalProperties": false
},
"response": {
"type": "object",
"required": ["v", "id", "type"],
"properties": {
"v": {
"const": "gabp/1",
"description": "Protocol version identifier"
},
"id": {
"$ref": "#/$defs/uuid",
"description": "Request identifier this response corresponds to"
},
"type": {
"const": "response",
"description": "Message type"
},
"result": {
"description": "Successful method result"
},
"error": {
"$ref": "#/$defs/error",
"description": "Error information if method failed"
}
},
"allOf": [
{ "not": { "required": ["result", "error"] } },
{ "anyOf": [
{ "required": ["result"] },
{ "required": ["error"] }
]}
],
"additionalProperties": false
},
"event": {
"type": "object",
"required": ["v", "id", "type", "channel", "seq", "payload"],
"properties": {
"v": {
"const": "gabp/1",
"description": "Protocol version identifier"
},
"id": {
"$ref": "#/$defs/uuid",
"description": "Unique event identifier"
},
"type": {
"const": "event",
"description": "Message type"
},
"channel": {
"type": "string",
"minLength": 1,
"description": "Event channel name"
},
"seq": {
"type": "integer",
"minimum": 0,
"description": "Sequence number for this channel"
},
"payload": {
"description": "Event-specific data"
}
},
"additionalProperties": false
}
}
}