-
Notifications
You must be signed in to change notification settings - Fork 82
/
OpenAPI.java
357 lines (316 loc) · 10.3 KB
/
OpenAPI.java
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
/**
* Copyright (c) 2017 Contributors to the Eclipse Foundation
* Copyright 2017 SmartBear Software
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.eclipse.microprofile.openapi.models;
import java.util.List;
import java.util.Map;
import org.eclipse.microprofile.openapi.models.info.Info;
import org.eclipse.microprofile.openapi.models.security.SecurityRequirement;
import org.eclipse.microprofile.openapi.models.servers.Server;
import org.eclipse.microprofile.openapi.models.tags.Tag;
/**
* OpenAPI
* <p>
* This is the root document object of the OpenAPI document. It contains required and optional fields.
*
* @see <a href= "https://spec.openapis.org/oas/v3.1.0.html#openapi-object">OpenAPI Specification OpenAPI Object</a>
*/
public interface OpenAPI extends Constructible, Extensible<OpenAPI> {
/**
* Returns the openapi property from an OpenAPI instance.
*
* @return the semantic version number of the OpenAPI Specification version that the OpenAPI document uses
**/
String getOpenapi();
/**
* Sets this OpenAPI instance's openapi property to the given string.
*
* @param openapi
* the semantic version number of the OpenAPI Specification version that the OpenAPI document uses
*/
void setOpenapi(String openapi);
/**
* Sets this OpenAPI instance's openapi property to the given string.
*
* @param openapi
* the semantic version number of the OpenAPI Specification version that the OpenAPI document uses
* @return the current OpenAPI object
*/
default OpenAPI openapi(String openapi) {
setOpenapi(openapi);
return this;
}
/**
* Returns the info property from an OpenAPI instance.
*
* @return metadata about the API
**/
Info getInfo();
/**
* Sets this OpenAPI instance's info property to the given object.
*
* @param info
* metadata about the API
*/
void setInfo(Info info);
/**
* Sets this OpenAPI instance's info property to the given object.
*
* @param info
* metadata about the API
* @return the current OpenAPI object
*/
default OpenAPI info(Info info) {
setInfo(info);
return this;
}
/**
* Returns the externalDocs property from an OpenAPI instance.
*
* @return additional external documentation
**/
ExternalDocumentation getExternalDocs();
/**
* Sets this OpenAPI instance's externalDocs property to the given object.
*
* @param externalDocs
* additional external documentation.
*/
void setExternalDocs(ExternalDocumentation externalDocs);
/**
* Sets this OpenAPI instance's externalDocs property to the given object.
*
* @param externalDocs
* additional external documentation
* @return the current OpenAPI object
*/
default OpenAPI externalDocs(ExternalDocumentation externalDocs) {
setExternalDocs(externalDocs);
return this;
}
/**
* Returns the Servers defined in the API
*
* @return a copy List (potentially immutable) of Server objects which provide connectivity information to target
* servers
**/
List<Server> getServers();
/**
* Sets this OpenAPI instance's servers property to the given servers.
*
* @param servers
* Server objects which provide connectivity information to target servers
*/
void setServers(List<Server> servers);
/**
* Sets this OpenAPI instance's servers property to the given servers.
*
* @param servers
* Server objects which provide connectivity information to target servers
* @return the current OpenAPI object
*/
default OpenAPI servers(List<Server> servers) {
setServers(servers);
return this;
}
/**
* Adds the given server to this OpenAPI instance's list of servers.
*
* @param server
* Server object which provides connectivity information to a target server
* @return the current OpenAPI object
*/
OpenAPI addServer(Server server);
/**
* Removes the given server to this OpenAPI instance's list of servers.
*
* @param server
* Server object which provides connectivity information to a target server
*/
void removeServer(Server server);
/**
* Returns the security property from an OpenAPI instance.
*
* @return a copy List (potentially immutable) containing the security mechanisms that can be used across the API
**/
List<SecurityRequirement> getSecurity();
/**
* Sets this OpenAPI instance's security property to the given list.
*
* @param security
* which security mechanisms can be used across the API
*/
void setSecurity(List<SecurityRequirement> security);
/**
* Sets this OpenAPI instance's security property to the given list.
*
* @param security
* which security mechanisms can be used across the API
* @return the current OpenAPI object
*/
default OpenAPI security(List<SecurityRequirement> security) {
setSecurity(security);
return this;
}
/**
* Adds the given security requirement to this OpenAPI instance's list of security requirements.
*
* @param securityRequirement
* security mechanism which can be used across the API
* @return the current OpenAPI object
*/
OpenAPI addSecurityRequirement(SecurityRequirement securityRequirement);
/**
* Removes the given security requirement to this OpenAPI instance's list of security requirements.
*
* @param securityRequirement
* security mechanism which can be used across the API
*/
void removeSecurityRequirement(SecurityRequirement securityRequirement);
/**
* Returns the tags property from an OpenAPI instance.
*
* @return a copy List (potentially immutable) of tags defined in this the specification
**/
List<Tag> getTags();
/**
* Sets this OpenAPI instance's tags property to the given Tags.
*
* @param tags
* tags used by the specification with additional metadata
*/
void setTags(List<Tag> tags);
/**
* Sets this OpenAPI instance's tags property to the given tags.
*
* @param tags
* tags used by the specification with additional metadata
* @return the current OpenAPI object
*/
default OpenAPI tags(List<Tag> tags) {
setTags(tags);
return this;
}
/**
* Adds the given tag to this OpenAPI instance's list of tags.
*
* @param tag
* a tag used by the specification with additional metadata
* @return the current OpenAPI object
*/
OpenAPI addTag(Tag tag);
/**
* Removes the given tag to this OpenAPI instance's list of tags.
*
* @param tag
* a tag used by the specification with additional metadata
*/
void removeTag(Tag tag);
/**
* Returns the paths property from an OpenAPI instance.
*
* @return the available paths and operations for the API
**/
Paths getPaths();
/**
* Sets this OpenAPI instance's paths property to the given paths.
*
* @param paths
* the available paths and operations for the API
*/
void setPaths(Paths paths);
/**
* Sets this OpenAPI instance's paths property to the given paths.
*
* @param paths
* the available paths and operations for the API
* @return the current OpenAPI object
*/
default OpenAPI paths(Paths paths) {
setPaths(paths);
return this;
}
/**
* Returns the webhooks property of this OpenAPI instance.
*
* @return a copy Map (potentially immutable) of named webhook definitions
* @since 4.0
*/
Map<String, PathItem> getWebhooks();
/**
* Sets the webhooks property of this OpenAPI instance.
*
* @param webhooks
* a map of named webhook definitions
* @since 4.0
*/
void setWebhooks(Map<String, PathItem> webhooks);
/**
* Sets the webhooks property of this OpenAPI instance.
*
* @param webhooks
* a map of named webhook definitions
* @return the current Schema instance
* @since 4.0
*/
default OpenAPI webhooks(Map<String, PathItem> webhooks) {
setWebhooks(webhooks);
return this;
}
/**
* Adds a webhook definition.
*
* @param name
* unique name of the webhook to add
* @param webhook
* webhook definition to add
* @return the current Schema instance
* @since 4.0
*/
OpenAPI addWebhook(String name, PathItem webhook);
/**
* Removes a webhook definition.
*
* @param name
* unique name of the webhook to remove
* @since 4.0
*/
void removeWebhook(String name);
/**
* Returns the components property from an OpenAPI instance.
*
* @return schemas used in the specification
**/
Components getComponents();
/**
* Sets this OpenAPI instance's components property to the given components.
*
* @param components
* a set of reusable objects used in the API specification
*/
void setComponents(Components components);
/**
* Sets this OpenAPI instance's components property to the given components.
*
* @param components
* a set of reusable objects used in the API specification
* @return the current OpenAPI object
*/
default OpenAPI components(Components components) {
setComponents(components);
return this;
}
}