/
PathItem.java
423 lines (375 loc) · 11.7 KB
/
PathItem.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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
/**
* 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.parameters.Parameter;
import org.eclipse.microprofile.openapi.models.servers.Server;
/**
* PathItem
* <p>
* Describes the operations available on a single path. A Path Item MAY be empty, due to
* <a href= "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#security-filtering">security
* constraints</a>. In that case the path itself is still exposed to the documentation viewer but you will not know
* which operations and parameters are available.
* <p>
*
* @see <a href= "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathItemObject"> OpenAPI
* Specification Path Item Object</a>
*/
public interface PathItem extends Constructible, Extensible<PathItem>, Reference<PathItem> {
/**
* All of the possible types of HTTP operations for this path
**/
enum HttpMethod {
POST, GET, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE
}
/**
* Returns the summary property from a PathItem instance.
*
* @return a short summary of what the path item represents
**/
String getSummary();
/**
* Sets this PathItem's summary property to the given string.
*
* @param summary
* short summary of what the path item represents
**/
void setSummary(String summary);
/**
* Sets this PathItem's summary property to the given string.
*
* @param summary
* short summary of what the path item represents
* @return the current PathItem instance
**/
default PathItem summary(String summary) {
setSummary(summary);
return this;
}
/**
* Returns the description property from a PathItem instance.
*
* @return a detailed description of what the path item represents
**/
String getDescription();
/**
* Sets this PathItem's description property to the given string.
*
* @param description
* detailed description of what the path item represents
**/
void setDescription(String description);
/**
* Sets this PathItem's description property to the given string.
*
* @param description
* detailed description of what the path item represents
* @return the current PathItem instance
**/
default PathItem description(String description) {
setDescription(description);
return this;
}
/**
* Returns the get property from a PathItem instance.
*
* @return definition of a GET operation on this path
**/
Operation getGET();
/**
* Sets this PathItem's get property to the given operation.
*
* @param get
* definition of a GET operation
**/
void setGET(Operation get);
/**
* Sets this PathItem's get property to the given operation.
*
* @param get
* definition of a GET operation
* @return the current PathItem instance
**/
default PathItem GET(Operation get) {
setGET(get);
return this;
}
/**
* Returns the put property from a PathItem instance.
*
* @return definition of a PUT operation on this path
**/
Operation getPUT();
/**
* Sets this PathItem's put property to the given operation.
*
* @param put
* definition of a PUT operation
**/
void setPUT(Operation put);
/**
* Sets this PathItem's put property to the given operation.
*
* @param put
* definition of a PUT operation
* @return the current PathItem instance
**/
default PathItem PUT(Operation put) {
setPUT(put);
return this;
}
/**
* Returns the post property from a PathItem instance.
*
* @return definition of a POST operation on this path
**/
Operation getPOST();
/**
* Sets this PathItem's post property to the given operation.
*
* @param post
* definition of a PUT operation
**/
void setPOST(Operation post);
/**
* Sets this PathItem's post property to the given operation.
*
* @param post
* definition of a PUT operation
* @return the current PathItem instance
**/
default PathItem POST(Operation post) {
setPOST(post);
return this;
}
/**
* Returns the delete property from a PathItem instance.
*
* @return definition of a DELETE operation on this path
**/
Operation getDELETE();
/**
* Sets this PathItem's delete property to the given operation.
*
* @param delete
* definition of a DELETE operation
**/
void setDELETE(Operation delete);
/**
* Sets this PathItem's delete property to the given operation.
*
* @param delete
* definition of a DELETE operation
* @return the current PathItem instance
**/
default PathItem DELETE(Operation delete) {
setDELETE(delete);
return this;
}
/**
* Returns the options property from a PathItem instance.
*
* @return definition of an OPTIONS operation on this path
**/
Operation getOPTIONS();
/**
* Sets this PathItem's options property to the given operation.
*
* @param options
* definition of an OPTIONS operation
**/
void setOPTIONS(Operation options);
/**
* Sets this PathItem's options property to the given operation.
*
* @param options
* definition of an OPTIONS operation
* @return the current PathItem instance
**/
default PathItem OPTIONS(Operation options) {
setOPTIONS(options);
return this;
}
/**
* Returns the head property from a PathItem instance.
*
* @return definition of a HEAD operation on this path
**/
Operation getHEAD();
/**
* Sets this PathItem's head property to the given operation.
*
* @param head
* definition of a HEAD operation
**/
void setHEAD(Operation head);
/**
* Sets this PathItem's head property to the given operation.
*
* @param head
* definition of a HEAD operation
* @return the current PathItem instance
**/
default PathItem HEAD(Operation head) {
setHEAD(head);
return this;
}
/**
* Returns the patch property from a PathItem instance.
*
* @return definition of a PATCH operation on this path
**/
Operation getPATCH();
/**
* Sets this PathItem's patch property to the given operation.
*
* @param patch
* definition of a PATCH operation
**/
void setPATCH(Operation patch);
/**
* Sets this PathItem's patch property to the given operation.
*
* @param patch
* definition of a PATCH operation
* @return the current PathItem instance
**/
default PathItem PATCH(Operation patch) {
setPATCH(patch);
return this;
}
/**
* Returns the trace property from a PathItem instance.
*
* @return definition of a TRACE operation on this path
**/
Operation getTRACE();
/**
* Sets this PathItem's trace property to the given operation.
*
* @param trace
* definition of a TRACE operation
**/
void setTRACE(Operation trace);
/**
* Sets this PathItem's trace property to the given operation.
*
* @param trace
* definition of a TRACE operation
* @return the current PathItem instance
**/
default PathItem TRACE(Operation trace) {
setTRACE(trace);
return this;
}
/**
* Returns a map with all the operations for this path where the keys are {@link PathItem.HttpMethod} items
*
* @return a map with all the operations for this path where the keys are HttpMethods
**/
Map<PathItem.HttpMethod, Operation> getOperations();
/**
* Sets an operation for a given http method.
*
* @param httpMethod
* the http method
* @param operation
* the definition of an operation for the given http method.
*/
void setOperation(PathItem.HttpMethod httpMethod, Operation operation);
/**
* Returns the servers property from a PathItem instance.
*
* @return a copy List (potentially immutable) of all the servers defined in this path item
**/
List<Server> getServers();
/**
* Sets this PathItem's servers property to the given list.
*
* @param servers
* a list of the servers to service operations in this path item
**/
void setServers(List<Server> servers);
/**
* Sets this PathItem's servers property to the given list.
*
* @param servers
* a list of the servers to service operations in this path item
* @return the current PathItem instance
**/
default PathItem servers(List<Server> servers) {
setServers(servers);
return this;
}
/**
* Adds the given server to this PathItem's list of servers.
*
* @param server
* a server to service operations in this path item
* @return the current PathItem instance
**/
PathItem addServer(Server server);
/**
* Removes the given server to this PathItem's list of servers.
*
* @param server
* a server to service operations in this path item
**/
void removeServer(Server server);
/**
* Returns the parameters property from this PathItem instance.
*
* @return a copy List (potentially immutable) of parameters that are applicable to all the operations described
* under this path
**/
List<Parameter> getParameters();
/**
* Sets this PathItem's parameters property to the given list.
*
* @param parameters
* a list of parameters that are applicable to all the operations described under this path
**/
void setParameters(List<Parameter> parameters);
/**
* Sets this PathItem's parameters property to the given list.
*
* @param parameters
* a list of parameters that are applicable to all the operations described under this path
* @return the current PathItem instance
**/
default PathItem parameters(List<Parameter> parameters) {
setParameters(parameters);
return this;
}
/**
* Adds the given parameter to this PathItem's list of parameters.
*
* @param parameter
* a parameter that is applicable to all the operations described under this path
* @return the current PathItem instance
**/
PathItem addParameter(Parameter parameter);
/**
* Removes the given parameter to this PathItem's list of parameters.
*
* @param parameter
* a parameter that is applicable to all the operations described under this path
**/
void removeParameter(Parameter parameter);
}