1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.juneau.annotation;
18
19 import static java.lang.annotation.RetentionPolicy.*;
20
21 import java.lang.annotation.*;
22
23 /**
24 * Swagger items annotation.
25 *
26 * <p>
27 * This class is essentially identical to {@link Items} except it's used for defining items of items.
28 *
29 * <p>
30 * Since annotations cannot be nested, we're forced to create a separate annotation for it.
31 * <br>If you want to nest items further, you have to define them free-form using {@link #items()} as free-form JSON.
32 *
33 * <h5 class='section'>See Also:</h5><ul>
34 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanSwagger2">juneau-bean-swagger-v2</a>
35 * <li class='extlink'><a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>
36
37 * </ul>
38 */
39 @Documented
40 @Retention(RUNTIME)
41 public @interface SubItems {
42
43 /**
44 * <mk>default</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
45 *
46 * <h5 class='section'>Notes:</h5><ul>
47 * <li class='note'>
48 * The format is a plain-text string.
49 * </ul>
50 *
51 * @return The annotation value.
52 */
53 String[] default_() default {};
54
55 /**
56 * <mk>enum</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
57 *
58 * <h5 class='section'>Notes:</h5><ul>
59 * <li class='note'>
60 * The format is a plain-text string.
61 * </ul>
62 *
63 * @return The annotation value.
64 */
65 String[] enum_() default {};
66
67 /**
68 * <mk>$ref</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
69 *
70 * <h5 class='section'>Notes:</h5><ul>
71 * <li class='note'>
72 * The format is a plain-text string.
73 * </ul>
74 *
75 * @return The annotation value.
76 */
77 String $ref() default "";
78
79 /**
80 * Synonym for {@link #collectionFormat()}.
81 *
82 * @return The annotation value.
83 */
84 String cf() default "";
85
86 /**
87 * <mk>collectionFormat</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
88 *
89 * <h5 class='section'>Notes:</h5><ul>
90 * <li class='note'>
91 * The format is a plain-text string.
92 * </ul>
93 *
94 * @return The annotation value.
95 */
96 String collectionFormat() default "";
97
98 /**
99 * Optional description for the exposed API.
100 *
101 * @return The annotation value.
102 * @since 9.2.0
103 */
104 String[] description() default {};
105
106 /**
107 * Synonym for {@link #default_()}.
108 *
109 * @return The annotation value.
110 */
111 String[] df() default {};
112
113 /**
114 * Synonym for {@link #enum_()}.
115 *
116 * @return The annotation value.
117 */
118 String[] e() default {};
119
120 /**
121 * Synonym for {@link #exclusiveMaximum()}.
122 *
123 * @return The annotation value.
124 */
125 boolean emax() default false;
126
127 /**
128 * Synonym for {@link #exclusiveMinimum()}.
129 *
130 * @return The annotation value.
131 */
132 boolean emin() default false;
133
134 /**
135 * <mk>exclusiveMaximum</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
136 *
137 * <h5 class='section'>Notes:</h5><ul>
138 * <li class='note'>
139 * The format is a plain-text string.
140 * </ul>
141 *
142 * @return The annotation value.
143 */
144 boolean exclusiveMaximum() default false;
145
146 /**
147 * <mk>exclusiveMinimum</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
148 *
149 * <h5 class='section'>Notes:</h5><ul>
150 * <li class='note'>
151 * The format is a plain-text string.
152 * </ul>
153 *
154 * @return The annotation value.
155 */
156 boolean exclusiveMinimum() default false;
157
158 /**
159 * Synonym for {@link #format()}.
160 *
161 * @return The annotation value.
162 */
163 String f() default "";
164
165 /**
166 * <mk>format</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
167 *
168 * <h5 class='section'>Notes:</h5><ul>
169 * <li class='note'>
170 * The format is a plain-text string.
171 * </ul>
172 *
173 * @return The annotation value.
174 */
175 String format() default "";
176
177 /**
178 * <mk>items</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
179 *
180 * <p>
181 * Describes the type of items in the array.
182 *
183 * <p>
184 * This is a <a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanSwagger2">juneau-bean-swagger-v2</a> object.
185 * <br>It must be declared free-form because it's not possible to nest annotations in Java.
186 *
187 * @return The annotation value.
188 */
189 String[] items() default {};
190
191 /**
192 * Synonym for {@link #maximum()}.
193 *
194 * @return The annotation value.
195 */
196 String max() default "";
197
198 /**
199 * Synonym for {@link #maxItems()}.
200 *
201 * @return The annotation value.
202 */
203 long maxi() default -1;
204
205 /**
206 * <mk>maximum</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
207 *
208 * <h5 class='section'>Notes:</h5><ul>
209 * <li class='note'>
210 * The format is a plain-text string.
211 * </ul>
212 *
213 * @return The annotation value.
214 */
215 String maximum() default "";
216
217 /**
218 * <mk>maxItems</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
219 *
220 * <h5 class='section'>Notes:</h5><ul>
221 * <li class='note'>
222 * The format is a plain-text string.
223 * </ul>
224 *
225 * @return The annotation value.
226 */
227 long maxItems() default -1;
228
229 /**
230 * Synonym for {@link #maxLength()}.
231 *
232 * @return The annotation value.
233 */
234 long maxl() default -1;
235
236 /**
237 * <mk>maxLength</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
238 *
239 * <h5 class='section'>Notes:</h5><ul>
240 * <li class='note'>
241 * The format is a plain-text string.
242 * </ul>
243 *
244 * @return The annotation value.
245 */
246 long maxLength() default -1;
247
248 /**
249 * Synonym for {@link #minimum()}.
250 *
251 * @return The annotation value.
252 */
253 String min() default "";
254
255 /**
256 * Synonym for {@link #minItems()}.
257 *
258 * @return The annotation value.
259 */
260 long mini() default -1;
261
262 /**
263 * <mk>minimum</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
264 *
265 * <h5 class='section'>Notes:</h5><ul>
266 * <li class='note'>
267 * The format is a plain-text string.
268 * </ul>
269 *
270 * @return The annotation value.
271 */
272 String minimum() default "";
273
274 /**
275 * <mk>minItems</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
276 *
277 * <h5 class='section'>Notes:</h5><ul>
278 * <li class='note'>
279 * The format is a plain-text string.
280 * </ul>
281 *
282 * @return The annotation value.
283 */
284 long minItems() default -1;
285
286 /**
287 * Synonym for {@link #minLength()}.
288 *
289 * @return The annotation value.
290 */
291 long minl() default -1;
292
293 /**
294 * <mk>minLength</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
295 *
296 * <h5 class='section'>Notes:</h5><ul>
297 * <li class='note'>
298 * The format is a plain-text string.
299 * </ul>
300 *
301 * @return The annotation value.
302 */
303 long minLength() default -1;
304
305 /**
306 * Synonym for {@link #multipleOf()}.
307 *
308 * @return The annotation value.
309 */
310 String mo() default "";
311
312 /**
313 * <mk>multipleOf</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
314 *
315 * <h5 class='section'>Notes:</h5><ul>
316 * <li class='note'>
317 * The format is a plain-text string.
318 * </ul>
319 *
320 * @return The annotation value.
321 */
322 String multipleOf() default "";
323
324 /**
325 * Synonym for {@link #pattern()}.
326 *
327 * @return The annotation value.
328 */
329 String p() default "";
330
331 /**
332 * <mk>pattern</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
333 *
334 * <h5 class='section'>Notes:</h5><ul>
335 * <li class='note'>
336 * The format is a plain-text string.
337 * </ul>
338 *
339 * @return The annotation value.
340 */
341 String pattern() default "";
342
343 /**
344 * Synonym for {@link #type()}.
345 *
346 * @return The annotation value.
347 */
348 String t() default "";
349
350 /**
351 * <mk>type</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
352 *
353 * <h5 class='section'>Notes:</h5><ul>
354 * <li class='note'>
355 * The format is a plain-text string.
356 * </ul>
357 *
358 * @return The annotation value.
359 */
360 String type() default "";
361
362 /**
363 * Synonym for {@link #uniqueItems()}.
364 *
365 * @return The annotation value.
366 */
367 boolean ui() default false;
368
369 /**
370 * <mk>uniqueItems</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>.
371 *
372 * <h5 class='section'>Notes:</h5><ul>
373 * <li class='note'>
374 * The format is a plain-text string.
375 * </ul>
376 *
377 * @return The annotation value.
378 */
379 boolean uniqueItems() default false;
380 }