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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
use IndexMap;
use ;
use crate::;
/// An object representing a message broker, a server or any other kind of
/// computer program capable of sending and/or receiving data. This object is
/// used to capture details such as URIs, protocols and security configuration.
/// Variable substitution can be used so that some details, for example
/// usernames and passwords, can be injected by code generation tools.
///
/// # Examples
///
/// A single server would be described as:
/// ```json
/// {
/// "url": "development.gigantic-server.com",
/// "description": "Development server",
/// "protocol": "kafka",
/// "protocolVersion": "1.0.0"
/// }
/// ```
///
/// ```yaml
/// url: development.gigantic-server.com
/// description: Development server
/// protocol: kafka
/// protocolVersion: '1.0.0'
/// ```
///
/// The following shows how multiple servers can be described, for example,
/// at the AsyncAPI Object's `servers`:
///
/// ```json
/// {
/// "servers": {
/// "development": {
/// "url": "development.gigantic-server.com",
/// "description": "Development server",
/// "protocol": "amqp",
/// "protocolVersion": "0.9.1"
/// },
/// "staging": {
/// "url": "staging.gigantic-server.com",
/// "description": "Staging server",
/// "protocol": "amqp",
/// "protocolVersion": "0.9.1"
/// },
/// "production": {
/// "url": "api.gigantic-server.com",
/// "description": "Production server",
/// "protocol": "amqp",
/// "protocolVersion": "0.9.1"
/// }
/// }
/// }
/// ```
///
/// ```yaml
/// servers:
/// development:
/// url: development.gigantic-server.com
/// description: Development server
/// protocol: amqp
/// protocolVersion: 0.9.1
/// staging:
/// url: staging.gigantic-server.com
/// description: Staging server
/// protocol: amqp
/// protocolVersion: 0.9.1
/// production:
/// url: api.gigantic-server.com
/// description: Production server
/// protocol: amqp
/// protocolVersion: 0.9.1
/// ```
///
/// The following shows how variables can be used for a server configuration:
///
/// ```json
/// {
/// "servers": {
/// "production": {
/// "url": "{username}.gigantic-server.com:{port}/{basePath}",
/// "description": "The production API server",
/// "protocol": "secure-mqtt",
/// "variables": {
/// "username": {
/// "default": "demo",
/// "description": "This value is assigned by the service provider, in this example `gigantic-server.com`"
/// },
/// "port": {
/// "enum": [
/// "8883",
/// "8884"
/// ],
/// "default": "8883"
/// },
/// "basePath": {
/// "default": "v2"
/// }
/// }
/// }
/// }
/// }
/// ```
///
/// ```yaml
/// servers:
/// production:
/// url: '{username}.gigantic-server.com:{port}/{basePath}'
/// description: The production API server
/// protocol: secure-mqtt
/// variables:
/// username:
/// # note! no enum here means it is an open value
/// default: demo
/// description: This value is assigned by the service provider, in this example `gigantic-server.com`
/// port:
/// enum:
/// - '8883'
/// - '8884'
/// default: '8883'
/// basePath:
/// # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
/// default: v2
/// ```
/// An object representing a Server Variable for server URL
/// template substitution.
/// Lists the required security schemes to execute this operation. The name
/// used for each property MUST correspond to a security scheme declared in the
/// Security Schemes under the Components Object.
///
/// When a list of Security Requirement Objects is defined on a Server object,
/// only one of the Security Requirement Objects in the list needs to be
/// satisfied to authorize the connection.
///
/// # Examples
/// ## User/Password Security Requirement
///
/// ```json
/// {
/// "user_pass": []
/// }
/// ```
///
/// ```yaml
/// user_pass: []
/// ```
///
/// ## API Key Security Requirement
///
/// ```json
/// {
/// "api_key": []
/// }
/// ```
///
/// ```yaml
/// api_key: []
/// ```
///
/// ## OAuth2 Security Requirement
///
/// ```json
/// {
/// "petstore_auth": [
/// "write:pets",
/// "read:pets"
/// ]
/// }
/// ```
///
/// ```yaml
/// petstore_auth:
/// - write:pets
/// - read:pets
/// ```